Rule

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

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.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var ipset = new Aws.WafRegional.IpSet("ipset", new Aws.WafRegional.IpSetArgs
        {
            IpSetDescriptors = 
            {
                new Aws.WafRegional.Inputs.IpSetIpSetDescriptorArgs
                {
                    Type = "IPV4",
                    Value = "192.0.7.0/24",
                },
            },
        });
        var wafrule = new Aws.WafRegional.Rule("wafrule", new Aws.WafRegional.RuleArgs
        {
            MetricName = "tfWAFRule",
            Predicates = 
            {
                new Aws.WafRegional.Inputs.RulePredicateArgs
                {
                    DataId = ipset.Id,
                    Negated = false,
                    Type = "IPMatch",
                },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/wafregional"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        ipset, err := wafregional.NewIpSet(ctx, "ipset", &wafregional.IpSetArgs{
            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{
            MetricName: pulumi.String("tfWAFRule"),
            Predicates: wafregional.RulePredicateArray{
                &wafregional.RulePredicateArgs{
                    DataId:  ipset.ID(),
                    Negated: pulumi.Bool(false),
                    Type:    pulumi.String("IPMatch"),
                },
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

ipset = aws.wafregional.IpSet("ipset", ip_set_descriptors=[{
    "type": "IPV4",
    "value": "192.0.7.0/24",
}])
wafrule = aws.wafregional.Rule("wafrule",
    metric_name="tfWAFRule",
    predicates=[{
        "dataId": ipset.id,
        "negated": False,
        "type": "IPMatch",
    }])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const ipset = new aws.wafregional.IpSet("ipset", {
    ipSetDescriptors: [{
        type: "IPV4",
        value: "192.0.7.0/24",
    }],
});
const wafrule = new aws.wafregional.Rule("wafrule", {
    metricName: "tfWAFRule",
    predicates: [{
        dataId: ipset.id,
        negated: false,
        type: "IPMatch",
    }],
});

Create a Rule Resource

new Rule(name: string, args: RuleArgs, opts?: CustomResourceOptions);
def Rule(resource_name, opts=None, metric_name=None, name=None, predicates=None, tags=None, __props__=None);
func NewRule(ctx *Context, name string, args RuleArgs, opts ...ResourceOption) (*Rule, error)
public Rule(string name, RuleArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Rule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model 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<RulePredicateArgs>

The objects to include in a rule (documented below).

Tags Dictionary<string, string>

Key-value map of resource tags

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 map[string]string

Key-value map of resource tags

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

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 List[RulePredicate]

The objects to include in a rule (documented below).

tags Dict[str, str]

Key-value map of resource tags

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.
Arn string

The ARN of the WAF Regional Rule.

Id string
The provider-assigned unique ID for this managed resource.
arn string

The ARN of the WAF Regional Rule.

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

The ARN of the WAF Regional Rule.

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

Look up an 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
static get(resource_name, id, opts=None, arn=None, metric_name=None, name=None, predicates=None, tags=None, __props__=None);
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)
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.

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<RulePredicateArgs>

The objects to include in a rule (documented below).

Tags Dictionary<string, string>

Key-value map of resource tags

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 map[string]string

Key-value map of resource tags

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

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 List[RulePredicate]

The objects to include in a rule (documented below).

tags Dict[str, str]

Key-value map of resource tags

Supporting Types

RulePredicate

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DataId string
Negated bool
Type string
DataId string
Negated bool
Type string
dataId string
negated boolean
type string
dataId str
negated bool
type str

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.