RateBasedRule
Provides a WAF Rate Based 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.RateBasedRule("wafrule", new Aws.Waf.RateBasedRuleArgs
{
MetricName = "tfWAFRule",
Predicates =
{
new Aws.Waf.Inputs.RateBasedRulePredicateArgs
{
DataId = ipset.Id,
Negated = false,
Type = "IPMatch",
},
},
RateKey = "IP",
RateLimit = 100,
}, 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.NewRateBasedRule(ctx, "wafrule", &waf.RateBasedRuleArgs{
MetricName: pulumi.String("tfWAFRule"),
Predicates: waf.RateBasedRulePredicateArray{
&waf.RateBasedRulePredicateArgs{
DataId: ipset.ID(),
Negated: pulumi.Bool(false),
Type: pulumi.String("IPMatch"),
},
},
RateKey: pulumi.String("IP"),
RateLimit: pulumi.Int(100),
}, 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.RateBasedRule("wafrule",
metric_name="tfWAFRule",
predicates=[{
"dataId": ipset.id,
"negated": False,
"type": "IPMatch",
}],
rate_key="IP",
rate_limit=100,
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.RateBasedRule("wafrule", {
metricName: "tfWAFRule",
predicates: [{
dataId: ipset.id,
negated: false,
type: "IPMatch",
}],
rateKey: "IP",
rateLimit: 100,
}, { dependsOn: [ipset] });Create a RateBasedRule Resource
new RateBasedRule(name: string, args: RateBasedRuleArgs, opts?: CustomResourceOptions);def RateBasedRule(resource_name, opts=None, metric_name=None, name=None, predicates=None, rate_key=None, rate_limit=None, tags=None, __props__=None);func NewRateBasedRule(ctx *Context, name string, args RateBasedRuleArgs, opts ...ResourceOption) (*RateBasedRule, error)public RateBasedRule(string name, RateBasedRuleArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args RateBasedRuleArgs
- 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 RateBasedRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RateBasedRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
RateBasedRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The RateBasedRule resource accepts the following input properties:
- Metric
Name string The name or description for the Amazon CloudWatch metric of this rule.
- Rate
Key string Valid value is IP.
- Rate
Limit int The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- Name string
The name or description of the rule.
- Predicates
List<Rate
Based 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.
- Rate
Key string Valid value is IP.
- Rate
Limit int The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- Name string
The name or description of the rule.
- Predicates
[]Rate
Based 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.
- rate
Key string Valid value is IP.
- rate
Limit number The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- name string
The name or description of the rule.
- predicates
Rate
Based 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.
- rate_
key str Valid value is IP.
- rate_
limit float The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- name str
The name or description of the rule.
- predicates
List[Rate
Based 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 RateBasedRule resource produces the following output properties:
Look up an Existing RateBasedRule Resource
Get an existing RateBasedRule 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?: RateBasedRuleState, opts?: CustomResourceOptions): RateBasedRulestatic get(resource_name, id, opts=None, arn=None, metric_name=None, name=None, predicates=None, rate_key=None, rate_limit=None, tags=None, __props__=None);func GetRateBasedRule(ctx *Context, name string, id IDInput, state *RateBasedRuleState, opts ...ResourceOption) (*RateBasedRule, error)public static RateBasedRule Get(string name, Input<string> id, RateBasedRuleState? 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
Amazon Resource Name (ARN)
- Metric
Name string The name or description for the Amazon CloudWatch metric of this rule.
- Name string
The name or description of the rule.
- Predicates
List<Rate
Based Rule Predicate Args> The objects to include in a rule (documented below).
- Rate
Key string Valid value is IP.
- Rate
Limit int The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- Dictionary<string, string>
Key-value map of resource tags
- Arn string
Amazon Resource Name (ARN)
- Metric
Name string The name or description for the Amazon CloudWatch metric of this rule.
- Name string
The name or description of the rule.
- Predicates
[]Rate
Based Rule Predicate The objects to include in a rule (documented below).
- Rate
Key string Valid value is IP.
- Rate
Limit int The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- map[string]string
Key-value map of resource tags
- arn string
Amazon Resource Name (ARN)
- metric
Name string The name or description for the Amazon CloudWatch metric of this rule.
- name string
The name or description of the rule.
- predicates
Rate
Based Rule Predicate[] The objects to include in a rule (documented below).
- rate
Key string Valid value is IP.
- rate
Limit number The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- {[key: string]: string}
Key-value map of resource tags
- arn str
Amazon Resource Name (ARN)
- 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[Rate
Based Rule Predicate] The objects to include in a rule (documented below).
- rate_
key str Valid value is IP.
- rate_
limit float The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
- Dict[str, str]
Key-value map of resource tags
Supporting Types
RateBasedRulePredicate
- 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 specifiedByteMatchSet,IPSet,SqlInjectionMatchSet,XssMatchSet, orSizeConstraintSet. 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 specifiedByteMatchSet,IPSet,SqlInjectionMatchSet,XssMatchSet, orSizeConstraintSet. 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 specifiedByteMatchSet,IPSet,SqlInjectionMatchSet,XssMatchSet, orSizeConstraintSet. 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 specifiedByteMatchSet,IPSet,SqlInjectionMatchSet,XssMatchSet, orSizeConstraintSet. 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.