f5bigip.ltm.Ifile This resource creates an LTM iFile on F5 BIG-IP that references an existing system iFile.
LTM iFiles are used in iRules and LTM policies to access file content for traffic processing and decision making.
Example Usage
Using LTM iFile in iRule
import * as pulumi from "@pulumi/pulumi";
import * as f5bigip from "@pulumi/f5bigip";
const serverList = new f5bigip.sys.Ifile("server_list", {
name: "server-mapping",
partition: "Production",
content: `web1:10.1.1.10
web2:10.1.1.11
web3:10.1.1.12
`,
});
const ltmServers = new f5bigip.ltm.Ifile("ltm_servers", {
name: "ltm-server-mapping",
partition: "Production",
fileName: "/Production/server-mapping",
});
const serverSelector = new f5bigip.ltm.IRule("server_selector", {
name: "select-server-rule",
irule: `when HTTP_REQUEST {
set server_map [ifile get ltm-server-mapping]
# Process server mapping logic
foreach line [split server_map \\"\\
\\"] {
set parts [split line \\":\\"]
# Implement server selection logic
}
}
`,
});
import pulumi
import pulumi_f5bigip as f5bigip
server_list = f5bigip.sys.Ifile("server_list",
name="server-mapping",
partition="Production",
content="""web1:10.1.1.10
web2:10.1.1.11
web3:10.1.1.12
""")
ltm_servers = f5bigip.ltm.Ifile("ltm_servers",
name="ltm-server-mapping",
partition="Production",
file_name="/Production/server-mapping")
server_selector = f5bigip.ltm.IRule("server_selector",
name="select-server-rule",
irule="""when HTTP_REQUEST {
set server_map [ifile get ltm-server-mapping]
# Process server mapping logic
foreach line [split $server_map \"\
\"] {
set parts [split $line \":\"]
# Implement server selection logic
}
}
""")
package main
import (
"github.com/pulumi/pulumi-f5bigip/sdk/v3/go/f5bigip/ltm"
"github.com/pulumi/pulumi-f5bigip/sdk/v3/go/f5bigip/sys"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sys.NewIfile(ctx, "server_list", &sys.IfileArgs{
Name: pulumi.String("server-mapping"),
Partition: pulumi.String("Production"),
Content: pulumi.String("web1:10.1.1.10\nweb2:10.1.1.11\nweb3:10.1.1.12\n"),
})
if err != nil {
return err
}
_, err = ltm.NewIfile(ctx, "ltm_servers", <m.IfileArgs{
Name: pulumi.String("ltm-server-mapping"),
Partition: pulumi.String("Production"),
FileName: pulumi.String("/Production/server-mapping"),
})
if err != nil {
return err
}
_, err = ltm.NewIRule(ctx, "server_selector", <m.IRuleArgs{
Name: pulumi.String("select-server-rule"),
Irule: pulumi.String(`when HTTP_REQUEST {
set server_map [ifile get ltm-server-mapping]
# Process server mapping logic
foreach line [split $server_map \"\
\"] {
set parts [split $line \":\"]
# Implement server selection logic
}
}
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using F5BigIP = Pulumi.F5BigIP;
return await Deployment.RunAsync(() =>
{
var serverList = new F5BigIP.Sys.Ifile("server_list", new()
{
Name = "server-mapping",
Partition = "Production",
Content = @"web1:10.1.1.10
web2:10.1.1.11
web3:10.1.1.12
",
});
var ltmServers = new F5BigIP.Ltm.Ifile("ltm_servers", new()
{
Name = "ltm-server-mapping",
Partition = "Production",
FileName = "/Production/server-mapping",
});
var serverSelector = new F5BigIP.Ltm.IRule("server_selector", new()
{
Name = "select-server-rule",
Irule = @"when HTTP_REQUEST {
set server_map [ifile get ltm-server-mapping]
# Process server mapping logic
foreach line [split $server_map \""\
\""] {
set parts [split $line \"":\""]
# Implement server selection logic
}
}
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.f5bigip.ltm.IRule;
import com.pulumi.f5bigip.ltm.IRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var serverList = new com.pulumi.f5bigip.sys.Ifile("serverList", com.pulumi.f5bigip.sys.IfileArgs.builder()
.name("server-mapping")
.partition("Production")
.content("""
web1:10.1.1.10
web2:10.1.1.11
web3:10.1.1.12
""")
.build());
var ltmServers = new com.pulumi.f5bigip.ltm.Ifile("ltmServers", com.pulumi.f5bigip.ltm.IfileArgs.builder()
.name("ltm-server-mapping")
.partition("Production")
.fileName("/Production/server-mapping")
.build());
var serverSelector = new IRule("serverSelector", IRuleArgs.builder()
.name("select-server-rule")
.irule("""
when HTTP_REQUEST {
set server_map [ifile get ltm-server-mapping]
# Process server mapping logic
foreach line [split $server_map \"\
\"] {
set parts [split $line \":\"]
# Implement server selection logic
}
}
""")
.build());
}
}
resources:
serverList:
type: f5bigip:sys:Ifile
name: server_list
properties:
name: server-mapping
partition: Production
content: |
web1:10.1.1.10
web2:10.1.1.11
web3:10.1.1.12
ltmServers:
type: f5bigip:ltm:Ifile
name: ltm_servers
properties:
name: ltm-server-mapping
partition: Production
fileName: /Production/server-mapping
serverSelector:
type: f5bigip:ltm:IRule
name: server_selector
properties:
name: select-server-rule
irule: |
when HTTP_REQUEST {
set server_map [ifile get ltm-server-mapping]
# Process server mapping logic
foreach line [split $server_map \"\
\"] {
set parts [split $line \":\"]
# Implement server selection logic
}
}
Notes
- The referenced system iFile (specified in
file_name) must exist before creating the LTM iFile. - LTM iFiles are primarily used in iRules and LTM policies for traffic processing.
- Changes to
name,partition, orsub_pathwill force recreation of the resource. - The LTM iFile acts as a reference to the system iFile and doesn’t store content directly.
- Use
f5bigip.sys.Ifileto upload file content, then reference it withf5bigip.ltm.Ifilefor LTM usage.
Related Resources
f5bigip.sys.Ifile- Creates system iFiles with contentf5bigip.ltm.IRule- Creates iRules that can reference LTM iFilesf5bigip.ltm.Policy- Creates LTM policies that can use LTM iFiles
Create Ifile Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Ifile(name: string, args: IfileArgs, opts?: CustomResourceOptions);@overload
def Ifile(resource_name: str,
args: IfileArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Ifile(resource_name: str,
opts: Optional[ResourceOptions] = None,
file_name: Optional[str] = None,
name: Optional[str] = None,
partition: Optional[str] = None,
sub_path: Optional[str] = None)func NewIfile(ctx *Context, name string, args IfileArgs, opts ...ResourceOption) (*Ifile, error)public Ifile(string name, IfileArgs args, CustomResourceOptions? opts = null)type: f5bigip:ltm:Ifile
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args IfileArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args IfileArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args IfileArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args IfileArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args IfileArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var ifileResource = new F5BigIP.Ltm.Ifile("ifileResource", new()
{
FileName = "string",
Name = "string",
Partition = "string",
SubPath = "string",
});
example, err := ltm.NewIfile(ctx, "ifileResource", <m.IfileArgs{
FileName: pulumi.String("string"),
Name: pulumi.String("string"),
Partition: pulumi.String("string"),
SubPath: pulumi.String("string"),
})
var ifileResource = new com.pulumi.f5bigip.ltm.Ifile("ifileResource", com.pulumi.f5bigip.ltm.IfileArgs.builder()
.fileName("string")
.name("string")
.partition("string")
.subPath("string")
.build());
ifile_resource = f5bigip.ltm.Ifile("ifileResource",
file_name="string",
name="string",
partition="string",
sub_path="string")
const ifileResource = new f5bigip.ltm.Ifile("ifileResource", {
fileName: "string",
name: "string",
partition: "string",
subPath: "string",
});
type: f5bigip:ltm:Ifile
properties:
fileName: string
name: string
partition: string
subPath: string
Ifile Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Ifile resource accepts the following input properties:
- File
Name string - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - Name string
- Name of the LTM iFile to be created on BIG-IP.
- Partition string
- Partition where the LTM iFile will be created. Defaults to
Common. - Sub
Path string - Subdirectory within the partition for organizing iFiles.
- File
Name string - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - Name string
- Name of the LTM iFile to be created on BIG-IP.
- Partition string
- Partition where the LTM iFile will be created. Defaults to
Common. - Sub
Path string - Subdirectory within the partition for organizing iFiles.
- file
Name String - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - name String
- Name of the LTM iFile to be created on BIG-IP.
- partition String
- Partition where the LTM iFile will be created. Defaults to
Common. - sub
Path String - Subdirectory within the partition for organizing iFiles.
- file
Name string - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - name string
- Name of the LTM iFile to be created on BIG-IP.
- partition string
- Partition where the LTM iFile will be created. Defaults to
Common. - sub
Path string - Subdirectory within the partition for organizing iFiles.
- file_
name str - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - name str
- Name of the LTM iFile to be created on BIG-IP.
- partition str
- Partition where the LTM iFile will be created. Defaults to
Common. - sub_
path str - Subdirectory within the partition for organizing iFiles.
- file
Name String - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - name String
- Name of the LTM iFile to be created on BIG-IP.
- partition String
- Partition where the LTM iFile will be created. Defaults to
Common. - sub
Path String - Subdirectory within the partition for organizing iFiles.
Outputs
All input properties are implicitly available as output properties. Additionally, the Ifile resource produces the following output properties:
Look up Existing Ifile Resource
Get an existing Ifile resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: IfileState, opts?: CustomResourceOptions): Ifile@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
file_name: Optional[str] = None,
full_path: Optional[str] = None,
name: Optional[str] = None,
partition: Optional[str] = None,
sub_path: Optional[str] = None) -> Ifilefunc GetIfile(ctx *Context, name string, id IDInput, state *IfileState, opts ...ResourceOption) (*Ifile, error)public static Ifile Get(string name, Input<string> id, IfileState? state, CustomResourceOptions? opts = null)public static Ifile get(String name, Output<String> id, IfileState state, CustomResourceOptions options)resources: _: type: f5bigip:ltm:Ifile get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- File
Name string - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - Full
Path string - The complete path of the LTM iFile on the BIG-IP system.
- Name string
- Name of the LTM iFile to be created on BIG-IP.
- Partition string
- Partition where the LTM iFile will be created. Defaults to
Common. - Sub
Path string - Subdirectory within the partition for organizing iFiles.
- File
Name string - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - Full
Path string - The complete path of the LTM iFile on the BIG-IP system.
- Name string
- Name of the LTM iFile to be created on BIG-IP.
- Partition string
- Partition where the LTM iFile will be created. Defaults to
Common. - Sub
Path string - Subdirectory within the partition for organizing iFiles.
- file
Name String - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - full
Path String - The complete path of the LTM iFile on the BIG-IP system.
- name String
- Name of the LTM iFile to be created on BIG-IP.
- partition String
- Partition where the LTM iFile will be created. Defaults to
Common. - sub
Path String - Subdirectory within the partition for organizing iFiles.
- file
Name string - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - full
Path string - The complete path of the LTM iFile on the BIG-IP system.
- name string
- Name of the LTM iFile to be created on BIG-IP.
- partition string
- Partition where the LTM iFile will be created. Defaults to
Common. - sub
Path string - Subdirectory within the partition for organizing iFiles.
- file_
name str - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - full_
path str - The complete path of the LTM iFile on the BIG-IP system.
- name str
- Name of the LTM iFile to be created on BIG-IP.
- partition str
- Partition where the LTM iFile will be created. Defaults to
Common. - sub_
path str - Subdirectory within the partition for organizing iFiles.
- file
Name String - The system iFile name to reference (e.g.,
/Common/my-sys-ifile). This should reference an existing system iFile created withf5bigip.sys.Ifile. - full
Path String - The complete path of the LTM iFile on the BIG-IP system.
- name String
- Name of the LTM iFile to be created on BIG-IP.
- partition String
- Partition where the LTM iFile will be created. Defaults to
Common. - sub
Path String - Subdirectory within the partition for organizing iFiles.
Import
LTM iFiles can be imported using their full path:
bash
$ pulumi import f5bigip:ltm/ifile:Ifile example /Common/my-ltm-ifile
For iFiles with sub-paths:
bash
$ pulumi import f5bigip:ltm/ifile:Ifile example /Common/templates/my-ltm-ifile
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- f5 BIG-IP pulumi/pulumi-f5bigip
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
bigipTerraform Provider.
