1. Packages
  2. F5 BIG-IP
  3. API Docs
  4. ltm
  5. IRule
f5 BIG-IP v3.17.4 published on Wednesday, Sep 11, 2024 by Pulumi

f5bigip.ltm.IRule

Explore with Pulumi AI

f5bigip logo
f5 BIG-IP v3.17.4 published on Wednesday, Sep 11, 2024 by Pulumi

    f5bigip.ltm.IRule Creates iRule on BIG-IP F5 device

    For resources should be named with their “full path”. The full path is the combination of the partition + name of the resource. For example /Common/my-pool.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as f5bigip from "@pulumi/f5bigip";
    import * as std from "@pulumi/std";
    
    // Loading from a file is the preferred method
    const rule = new f5bigip.ltm.IRule("rule", {
        name: "/Common/terraform_irule",
        irule: std.file({
            input: "myirule.tcl",
        }).then(invoke => invoke.result),
    });
    const rule2 = new f5bigip.ltm.IRule("rule2", {
        name: "/Common/terraform_irule2",
        irule: `when CLIENT_ACCEPTED {
         log local0. "test"
       }
    `,
    });
    
    import pulumi
    import pulumi_f5bigip as f5bigip
    import pulumi_std as std
    
    # Loading from a file is the preferred method
    rule = f5bigip.ltm.IRule("rule",
        name="/Common/terraform_irule",
        irule=std.file(input="myirule.tcl").result)
    rule2 = f5bigip.ltm.IRule("rule2",
        name="/Common/terraform_irule2",
        irule="""when CLIENT_ACCEPTED {
         log local0. "test"
       }
    """)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-f5bigip/sdk/v3/go/f5bigip/ltm"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "myirule.tcl",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Loading from a file is the preferred method
    		_, err = ltm.NewIRule(ctx, "rule", &ltm.IRuleArgs{
    			Name:  pulumi.String("/Common/terraform_irule"),
    			Irule: pulumi.String(invokeFile.Result),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ltm.NewIRule(ctx, "rule2", &ltm.IRuleArgs{
    			Name:  pulumi.String("/Common/terraform_irule2"),
    			Irule: pulumi.String("when CLIENT_ACCEPTED {\n     log local0. \"test\"\n   }\n"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using F5BigIP = Pulumi.F5BigIP;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        // Loading from a file is the preferred method
        var rule = new F5BigIP.Ltm.IRule("rule", new()
        {
            Name = "/Common/terraform_irule",
            Irule = Std.File.Invoke(new()
            {
                Input = "myirule.tcl",
            }).Apply(invoke => invoke.Result),
        });
    
        var rule2 = new F5BigIP.Ltm.IRule("rule2", new()
        {
            Name = "/Common/terraform_irule2",
            Irule = @"when CLIENT_ACCEPTED {
         log local0. ""test""
       }
    ",
        });
    
    });
    
    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) {
            // Loading from a file is the preferred method
            var rule = new IRule("rule", IRuleArgs.builder()
                .name("/Common/terraform_irule")
                .irule(StdFunctions.file(FileArgs.builder()
                    .input("myirule.tcl")
                    .build()).result())
                .build());
    
            var rule2 = new IRule("rule2", IRuleArgs.builder()
                .name("/Common/terraform_irule2")
                .irule("""
    when CLIENT_ACCEPTED {
         log local0. "test"
       }
                """)
                .build());
    
        }
    }
    
    resources:
      # Loading from a file is the preferred method
      rule:
        type: f5bigip:ltm:IRule
        properties:
          name: /Common/terraform_irule
          irule:
            fn::invoke:
              Function: std:file
              Arguments:
                input: myirule.tcl
              Return: result
      rule2:
        type: f5bigip:ltm:IRule
        properties:
          name: /Common/terraform_irule2
          irule: |
            when CLIENT_ACCEPTED {
                 log local0. "test"
               }        
    

    ##myirule.tcl

    when HTTP_REQUEST {
    
      if { [string tolower [HTTP::header value Upgrade]] equals "websocket" } {
        HTTP::disable
    #    ASM::disable
        log local0. "[IP::client_addr] - Connection upgraded to websocket protocol. Disabling ASM-checks and HTTP protocol. Traffic is treated as L4 TCP stream."
      } else {
        HTTP::enable
    #    ASM::enable
        log local0. "[IP::client_addr] - Regular HTTP request. ASM-checks and HTTP protocol enabled. Traffic is deep-inspected at L7."
      }
    }
    

    Create IRule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new IRule(name: string, args: IRuleArgs, opts?: CustomResourceOptions);
    @overload
    def IRule(resource_name: str,
              args: IRuleArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def IRule(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              irule: Optional[str] = None,
              name: Optional[str] = None)
    func NewIRule(ctx *Context, name string, args IRuleArgs, opts ...ResourceOption) (*IRule, error)
    public IRule(string name, IRuleArgs args, CustomResourceOptions? opts = null)
    public IRule(String name, IRuleArgs args)
    public IRule(String name, IRuleArgs args, CustomResourceOptions options)
    
    type: f5bigip:ltm:IRule
    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 IRuleArgs
    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 IRuleArgs
    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 IRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IRuleArgs
    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 iruleResource = new F5BigIP.Ltm.IRule("iruleResource", new()
    {
        Irule = "string",
        Name = "string",
    });
    
    example, err := ltm.NewIRule(ctx, "iruleResource", &ltm.IRuleArgs{
    	Irule: pulumi.String("string"),
    	Name:  pulumi.String("string"),
    })
    
    var iruleResource = new IRule("iruleResource", IRuleArgs.builder()
        .irule("string")
        .name("string")
        .build());
    
    irule_resource = f5bigip.ltm.IRule("iruleResource",
        irule="string",
        name="string")
    
    const iruleResource = new f5bigip.ltm.IRule("iruleResource", {
        irule: "string",
        name: "string",
    });
    
    type: f5bigip:ltm:IRule
    properties:
        irule: string
        name: string
    

    IRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The IRule resource accepts the following input properties:

    Irule string
    Body of the iRule
    Name string
    Name of the iRule
    Irule string
    Body of the iRule
    Name string
    Name of the iRule
    irule String
    Body of the iRule
    name String
    Name of the iRule
    irule string
    Body of the iRule
    name string
    Name of the iRule
    irule str
    Body of the iRule
    name str
    Name of the iRule
    irule String
    Body of the iRule
    name String
    Name of the iRule

    Outputs

    All input properties are implicitly available as output properties. Additionally, the IRule resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing IRule Resource

    Get an existing IRule 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?: IRuleState, opts?: CustomResourceOptions): IRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            irule: Optional[str] = None,
            name: Optional[str] = None) -> IRule
    func GetIRule(ctx *Context, name string, id IDInput, state *IRuleState, opts ...ResourceOption) (*IRule, error)
    public static IRule Get(string name, Input<string> id, IRuleState? state, CustomResourceOptions? opts = null)
    public static IRule get(String name, Output<String> id, IRuleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    Irule string
    Body of the iRule
    Name string
    Name of the iRule
    Irule string
    Body of the iRule
    Name string
    Name of the iRule
    irule String
    Body of the iRule
    name String
    Name of the iRule
    irule string
    Body of the iRule
    name string
    Name of the iRule
    irule str
    Body of the iRule
    name str
    Name of the iRule
    irule String
    Body of the iRule
    name String
    Name of the iRule

    Package Details

    Repository
    f5 BIG-IP pulumi/pulumi-f5bigip
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the bigip Terraform Provider.
    f5bigip logo
    f5 BIG-IP v3.17.4 published on Wednesday, Sep 11, 2024 by Pulumi