Rule
Provides a WAF Rule Resource
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var ipset = new Aws.Waf.IpSet("ipset", new Aws.Waf.IpSetArgs
{
IpSetDescriptors =
{
new Aws.Waf.Inputs.IpSetIpSetDescriptorArgs
{
Type = "IPV4",
Value = "192.0.7.0/24",
},
},
});
var wafrule = new Aws.Waf.Rule("wafrule", new Aws.Waf.RuleArgs
{
MetricName = "tfWAFRule",
Predicates =
{
new Aws.Waf.Inputs.RulePredicateArgs
{
DataId = ipset.Id,
Negated = false,
Type = "IPMatch",
},
},
}, new CustomResourceOptions
{
DependsOn =
{
"aws_waf_ipset.ipset",
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/waf"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ipset, err := waf.NewIpSet(ctx, "ipset", &waf.IpSetArgs{
IpSetDescriptors: waf.IpSetIpSetDescriptorArray{
&waf.IpSetIpSetDescriptorArgs{
Type: pulumi.String("IPV4"),
Value: pulumi.String("192.0.7.0/24"),
},
},
})
if err != nil {
return err
}
_, err = waf.NewRule(ctx, "wafrule", &waf.RuleArgs{
MetricName: pulumi.String("tfWAFRule"),
Predicates: waf.RulePredicateArray{
&waf.RulePredicateArgs{
DataId: ipset.ID(),
Negated: pulumi.Bool(false),
Type: pulumi.String("IPMatch"),
},
},
}, pulumi.DependsOn([]pulumi.Resource{
"aws_waf_ipset.ipset",
}))
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
ipset = aws.waf.IpSet("ipset", ip_set_descriptors=[{
"type": "IPV4",
"value": "192.0.7.0/24",
}])
wafrule = aws.waf.Rule("wafrule",
metric_name="tfWAFRule",
predicates=[{
"dataId": ipset.id,
"negated": False,
"type": "IPMatch",
}],
opts=ResourceOptions(depends_on=["aws_waf_ipset.ipset"]))import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ipset = new aws.waf.IpSet("ipset", {
ipSetDescriptors: [{
type: "IPV4",
value: "192.0.7.0/24",
}],
});
const wafrule = new aws.waf.Rule("wafrule", {
metricName: "tfWAFRule",
predicates: [{
dataId: ipset.id,
negated: false,
type: "IPMatch",
}],
}, { dependsOn: [ipset] });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);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:
- Metric
Name string The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- Name string
The name or description of the rule.
- Predicates
List<Rule
Predicate Args> The objects to include in a rule (documented below).
- Dictionary<string, string>
Key-value map of resource tags
- Metric
Name string The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- Name string
The name or description of the rule.
- Predicates
[]Rule
Predicate The objects to include in a rule (documented below).
- map[string]string
Key-value map of resource tags
- metric
Name string The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- name string
The name or description of the rule.
- predicates
Rule
Predicate[] The objects to include in a rule (documented below).
- {[key: string]: string}
Key-value map of resource tags
- metric_
name str The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- name str
The name or description of the rule.
- predicates
List[Rule
Predicate] The objects to include in a rule (documented below).
- 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:
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): Rulestatic get(resource_name, id, opts=None, arn=None, metric_name=None, name=None, predicates=None, tags=None, __props__=None);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 rule.
- Metric
Name string The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- Name string
The name or description of the rule.
- Predicates
List<Rule
Predicate Args> The objects to include in a rule (documented below).
- Dictionary<string, string>
Key-value map of resource tags
- Arn string
The ARN of the WAF rule.
- Metric
Name string The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- Name string
The name or description of the rule.
- Predicates
[]Rule
Predicate The objects to include in a rule (documented below).
- map[string]string
Key-value map of resource tags
- arn string
The ARN of the WAF rule.
- metric
Name string The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- name string
The name or description of the rule.
- predicates
Rule
Predicate[] The objects to include in a rule (documented below).
- {[key: string]: string}
Key-value map of resource tags
- arn str
The ARN of the WAF rule.
- metric_
name str The name or description for the Amazon CloudWatch metric of this rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can’t contain whitespace.
- name str
The name or description of the rule.
- predicates
List[Rule
Predicate] The objects to include in a rule (documented below).
- Dict[str, str]
Key-value map of resource tags
Supporting Types
RulePredicate
- Data
Id string A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.
- Negated bool
Set this to
falseif you want to allow, block, or count requests based on the settings in the specifiedwaf_byte_match_set,waf_ipset,aws.waf.SizeConstraintSet,aws.waf.SqlInjectionMatchSetoraws.waf.XssMatchSet. For example, if an IPSet includes the IP address192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set totrue, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44.- Type string
The type of predicate in a rule. Valid values:
ByteMatch,GeoMatch,IPMatch,RegexMatch,SizeConstraint,SqlInjectionMatch, orXssMatch.
- Data
Id string A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.
- Negated bool
Set this to
falseif you want to allow, block, or count requests based on the settings in the specifiedwaf_byte_match_set,waf_ipset,aws.waf.SizeConstraintSet,aws.waf.SqlInjectionMatchSetoraws.waf.XssMatchSet. For example, if an IPSet includes the IP address192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set totrue, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44.- Type string
The type of predicate in a rule. Valid values:
ByteMatch,GeoMatch,IPMatch,RegexMatch,SizeConstraint,SqlInjectionMatch, orXssMatch.
- data
Id string A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.
- negated boolean
Set this to
falseif you want to allow, block, or count requests based on the settings in the specifiedwaf_byte_match_set,waf_ipset,aws.waf.SizeConstraintSet,aws.waf.SqlInjectionMatchSetoraws.waf.XssMatchSet. For example, if an IPSet includes the IP address192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set totrue, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44.- type string
The type of predicate in a rule. Valid values:
ByteMatch,GeoMatch,IPMatch,RegexMatch,SizeConstraint,SqlInjectionMatch, orXssMatch.
- data
Id str A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.
- negated bool
Set this to
falseif you want to allow, block, or count requests based on the settings in the specifiedwaf_byte_match_set,waf_ipset,aws.waf.SizeConstraintSet,aws.waf.SqlInjectionMatchSetoraws.waf.XssMatchSet. For example, if an IPSet includes the IP address192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set totrue, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44.- type str
The type of predicate in a rule. Valid values:
ByteMatch,GeoMatch,IPMatch,RegexMatch,SizeConstraint,SqlInjectionMatch, orXssMatch.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.