1. Packages
  2. AWS Classic
  3. API Docs
  4. wafregional
  5. Rule

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

aws.wafregional.Rule

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

    Provides an WAF Regional Rule Resource for use with Application Load Balancer.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const ipset = new aws.wafregional.IpSet("ipset", {
        name: "tfIPSet",
        ipSetDescriptors: [{
            type: "IPV4",
            value: "192.0.7.0/24",
        }],
    });
    const wafrule = new aws.wafregional.Rule("wafrule", {
        name: "tfWAFRule",
        metricName: "tfWAFRule",
        predicates: [{
            type: "IPMatch",
            dataId: ipset.id,
            negated: false,
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    ipset = aws.wafregional.IpSet("ipset",
        name="tfIPSet",
        ip_set_descriptors=[aws.wafregional.IpSetIpSetDescriptorArgs(
            type="IPV4",
            value="192.0.7.0/24",
        )])
    wafrule = aws.wafregional.Rule("wafrule",
        name="tfWAFRule",
        metric_name="tfWAFRule",
        predicates=[aws.wafregional.RulePredicateArgs(
            type="IPMatch",
            data_id=ipset.id,
            negated=False,
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/wafregional"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ipset, err := wafregional.NewIpSet(ctx, "ipset", &wafregional.IpSetArgs{
    			Name: pulumi.String("tfIPSet"),
    			IpSetDescriptors: wafregional.IpSetIpSetDescriptorArray{
    				&wafregional.IpSetIpSetDescriptorArgs{
    					Type:  pulumi.String("IPV4"),
    					Value: pulumi.String("192.0.7.0/24"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = wafregional.NewRule(ctx, "wafrule", &wafregional.RuleArgs{
    			Name:       pulumi.String("tfWAFRule"),
    			MetricName: pulumi.String("tfWAFRule"),
    			Predicates: wafregional.RulePredicateArray{
    				&wafregional.RulePredicateArgs{
    					Type:    pulumi.String("IPMatch"),
    					DataId:  ipset.ID(),
    					Negated: pulumi.Bool(false),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var ipset = new Aws.WafRegional.IpSet("ipset", new()
        {
            Name = "tfIPSet",
            IpSetDescriptors = new[]
            {
                new Aws.WafRegional.Inputs.IpSetIpSetDescriptorArgs
                {
                    Type = "IPV4",
                    Value = "192.0.7.0/24",
                },
            },
        });
    
        var wafrule = new Aws.WafRegional.Rule("wafrule", new()
        {
            Name = "tfWAFRule",
            MetricName = "tfWAFRule",
            Predicates = new[]
            {
                new Aws.WafRegional.Inputs.RulePredicateArgs
                {
                    Type = "IPMatch",
                    DataId = ipset.Id,
                    Negated = false,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.wafregional.IpSet;
    import com.pulumi.aws.wafregional.IpSetArgs;
    import com.pulumi.aws.wafregional.inputs.IpSetIpSetDescriptorArgs;
    import com.pulumi.aws.wafregional.Rule;
    import com.pulumi.aws.wafregional.RuleArgs;
    import com.pulumi.aws.wafregional.inputs.RulePredicateArgs;
    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 ipset = new IpSet("ipset", IpSetArgs.builder()        
                .name("tfIPSet")
                .ipSetDescriptors(IpSetIpSetDescriptorArgs.builder()
                    .type("IPV4")
                    .value("192.0.7.0/24")
                    .build())
                .build());
    
            var wafrule = new Rule("wafrule", RuleArgs.builder()        
                .name("tfWAFRule")
                .metricName("tfWAFRule")
                .predicates(RulePredicateArgs.builder()
                    .type("IPMatch")
                    .dataId(ipset.id())
                    .negated(false)
                    .build())
                .build());
    
        }
    }
    
    resources:
      ipset:
        type: aws:wafregional:IpSet
        properties:
          name: tfIPSet
          ipSetDescriptors:
            - type: IPV4
              value: 192.0.7.0/24
      wafrule:
        type: aws:wafregional:Rule
        properties:
          name: tfWAFRule
          metricName: tfWAFRule
          predicates:
            - type: IPMatch
              dataId: ${ipset.id}
              negated: false
    

    Nested Fields

    predicate

    See the WAF Documentation for more information.

    Arguments

    • type - (Required) The type of predicate in a rule. Valid values: ByteMatch, GeoMatch, IPMatch, RegexMatch, SizeConstraint, SqlInjectionMatch, or XssMatch
    • data_id - (Required) The unique identifier of a predicate, such as the ID of a ByteMatchSet or IPSet.
    • negated - (Required) Whether to use the settings or the negated settings that you specified in the objects.

    Create Rule Resource

    new Rule(name: string, args: RuleArgs, opts?: CustomResourceOptions);
    @overload
    def Rule(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             metric_name: Optional[str] = None,
             name: Optional[str] = None,
             predicates: Optional[Sequence[RulePredicateArgs]] = None,
             tags: Optional[Mapping[str, str]] = None)
    @overload
    def Rule(resource_name: str,
             args: RuleArgs,
             opts: Optional[ResourceOptions] = None)
    func NewRule(ctx *Context, name string, args RuleArgs, opts ...ResourceOption) (*Rule, error)
    public Rule(string name, RuleArgs args, CustomResourceOptions? opts = null)
    public Rule(String name, RuleArgs args)
    public Rule(String name, RuleArgs args, CustomResourceOptions options)
    
    type: aws:wafregional:Rule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args RuleArgs
    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 RuleArgs
    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 RuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Rule 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 Rule resource accepts the following input properties:

    MetricName string
    The name or description for the Amazon CloudWatch metric of this rule.
    Name string
    The name or description of the rule.
    Predicates List<RulePredicate>
    The objects to include in a rule (documented below).
    Tags Dictionary<string, string>
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    MetricName string
    The name or description for the Amazon CloudWatch metric of this rule.
    Name string
    The name or description of the rule.
    Predicates []RulePredicateArgs
    The objects to include in a rule (documented below).
    Tags map[string]string
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    metricName String
    The name or description for the Amazon CloudWatch metric of this rule.
    name String
    The name or description of the rule.
    predicates List<RulePredicate>
    The objects to include in a rule (documented below).
    tags Map<String,String>
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    metricName string
    The name or description for the Amazon CloudWatch metric of this rule.
    name string
    The name or description of the rule.
    predicates RulePredicate[]
    The objects to include in a rule (documented below).
    tags {[key: string]: string}
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    metric_name str
    The name or description for the Amazon CloudWatch metric of this rule.
    name str
    The name or description of the rule.
    predicates Sequence[RulePredicateArgs]
    The objects to include in a rule (documented below).
    tags Mapping[str, str]
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    metricName String
    The name or description for the Amazon CloudWatch metric of this rule.
    name String
    The name or description of the rule.
    predicates List<Property Map>
    The objects to include in a rule (documented below).
    tags Map<String>
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Outputs

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

    Arn string
    The ARN of the WAF Regional Rule.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    Arn string
    The ARN of the WAF Regional Rule.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn String
    The ARN of the WAF Regional Rule.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn string
    The ARN of the WAF Regional Rule.
    id string
    The provider-assigned unique ID for this managed resource.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn str
    The ARN of the WAF Regional Rule.
    id str
    The provider-assigned unique ID for this managed resource.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn String
    The ARN of the WAF Regional Rule.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    Look up Existing Rule Resource

    Get an existing Rule 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?: RuleState, opts?: CustomResourceOptions): Rule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            metric_name: Optional[str] = None,
            name: Optional[str] = None,
            predicates: Optional[Sequence[RulePredicateArgs]] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None) -> Rule
    func GetRule(ctx *Context, name string, id IDInput, state *RuleState, opts ...ResourceOption) (*Rule, error)
    public static Rule Get(string name, Input<string> id, RuleState? state, CustomResourceOptions? opts = null)
    public static Rule get(String name, Output<String> id, RuleState 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:
    Arn string
    The ARN of the WAF Regional Rule.
    MetricName string
    The name or description for the Amazon CloudWatch metric of this rule.
    Name string
    The name or description of the rule.
    Predicates List<RulePredicate>
    The objects to include in a rule (documented below).
    Tags Dictionary<string, string>
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    Arn string
    The ARN of the WAF Regional Rule.
    MetricName string
    The name or description for the Amazon CloudWatch metric of this rule.
    Name string
    The name or description of the rule.
    Predicates []RulePredicateArgs
    The objects to include in a rule (documented below).
    Tags map[string]string
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn String
    The ARN of the WAF Regional Rule.
    metricName String
    The name or description for the Amazon CloudWatch metric of this rule.
    name String
    The name or description of the rule.
    predicates List<RulePredicate>
    The objects to include in a rule (documented below).
    tags Map<String,String>
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn string
    The ARN of the WAF Regional Rule.
    metricName string
    The name or description for the Amazon CloudWatch metric of this rule.
    name string
    The name or description of the rule.
    predicates RulePredicate[]
    The objects to include in a rule (documented below).
    tags {[key: string]: string}
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn str
    The ARN of the WAF Regional Rule.
    metric_name str
    The name or description for the Amazon CloudWatch metric of this rule.
    name str
    The name or description of the rule.
    predicates Sequence[RulePredicateArgs]
    The objects to include in a rule (documented below).
    tags Mapping[str, str]
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    arn String
    The ARN of the WAF Regional Rule.
    metricName String
    The name or description for the Amazon CloudWatch metric of this rule.
    name String
    The name or description of the rule.
    predicates List<Property Map>
    The objects to include in a rule (documented below).
    tags Map<String>
    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:Please use tags instead.

    Supporting Types

    RulePredicate, RulePredicateArgs

    DataId string
    Negated bool
    Type string
    DataId string
    Negated bool
    Type string
    dataId String
    negated Boolean
    type String
    dataId string
    negated boolean
    type string
    data_id str
    negated bool
    type str
    dataId String
    negated Boolean
    type String

    Import

    Using pulumi import, import WAF Regional Rule using the id. For example:

    $ pulumi import aws:wafregional/rule:Rule wafrule a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
    

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi