aws.wafregional.Rule
Explore with Pulumi AI
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=[{
"type": "IPV4",
"value": "192.0.7.0/24",
}])
wafrule = aws.wafregional.Rule("wafrule",
name="tfWAFRule",
metric_name="tfWAFRule",
predicates=[{
"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
, orXssMatch
data_id
- (Required) The unique identifier of a predicate, such as the ID of aByteMatchSet
orIPSet
.negated
- (Required) Whether to use the settings or the negated settings that you specified in the objects.
Create Rule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Rule(name: string, args: RuleArgs, opts?: CustomResourceOptions);
@overload
def Rule(resource_name: str,
args: RuleArgs,
opts: Optional[ResourceOptions] = None)
@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)
func NewRule(ctx *Context, name string, args RuleArgs, opts ...ResourceOption) (*Rule, error)
public Rule(string name, RuleArgs args, CustomResourceOptions? opts = null)
type: aws:wafregional:Rule
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 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var exampleruleResourceResourceFromWafregionalrule = new Aws.WafRegional.Rule("exampleruleResourceResourceFromWafregionalrule", new()
{
MetricName = "string",
Name = "string",
Predicates = new[]
{
new Aws.WafRegional.Inputs.RulePredicateArgs
{
DataId = "string",
Negated = false,
Type = "string",
},
},
Tags =
{
{ "string", "string" },
},
});
example, err := wafregional.NewRule(ctx, "exampleruleResourceResourceFromWafregionalrule", &wafregional.RuleArgs{
MetricName: pulumi.String("string"),
Name: pulumi.String("string"),
Predicates: wafregional.RulePredicateArray{
&wafregional.RulePredicateArgs{
DataId: pulumi.String("string"),
Negated: pulumi.Bool(false),
Type: pulumi.String("string"),
},
},
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var exampleruleResourceResourceFromWafregionalrule = new Rule("exampleruleResourceResourceFromWafregionalrule", RuleArgs.builder()
.metricName("string")
.name("string")
.predicates(RulePredicateArgs.builder()
.dataId("string")
.negated(false)
.type("string")
.build())
.tags(Map.of("string", "string"))
.build());
examplerule_resource_resource_from_wafregionalrule = aws.wafregional.Rule("exampleruleResourceResourceFromWafregionalrule",
metric_name="string",
name="string",
predicates=[{
"data_id": "string",
"negated": False,
"type": "string",
}],
tags={
"string": "string",
})
const exampleruleResourceResourceFromWafregionalrule = new aws.wafregional.Rule("exampleruleResourceResourceFromWafregionalrule", {
metricName: "string",
name: "string",
predicates: [{
dataId: "string",
negated: false,
type: "string",
}],
tags: {
string: "string",
},
});
type: aws:wafregional:Rule
properties:
metricName: string
name: string
predicates:
- dataId: string
negated: false
type: string
tags:
string: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Rule resource accepts the following input properties:
- 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<Rule
Predicate> - The objects to include in a rule (documented below).
- 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.
- 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
[]Rule
Predicate Args - The objects to include in a rule (documented below).
- 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.
- 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<Rule
Predicate> - The objects to include in a rule (documented below).
- 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.
- 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
Rule
Predicate[] - The objects to include in a rule (documented below).
- {[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[Rule
Predicate Args] - The objects to include in a rule (documented below).
- 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.
- 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<Property Map>
- The objects to include in a rule (documented below).
- 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:
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.
- Arn string
- The ARN of the WAF Regional Rule.
- 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<Rule
Predicate> - The objects to include in a rule (documented below).
- 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. - Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Arn string
- The ARN of the WAF Regional Rule.
- 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
[]Rule
Predicate Args - The objects to include in a rule (documented below).
- 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. - map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- The ARN of the WAF Regional Rule.
- 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<Rule
Predicate> - The objects to include in a rule (documented below).
- 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. - Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn string
- The ARN of the WAF Regional Rule.
- 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
Rule
Predicate[] - The objects to include in a rule (documented below).
- {[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. - {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- 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[Rule
Predicate Args] - The objects to include in a rule (documented below).
- 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. - Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- The ARN of the WAF Regional Rule.
- 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<Property Map>
- The objects to include in a rule (documented below).
- 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. - Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Supporting Types
RulePredicate, RulePredicateArgs
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.