aws.waf.RuleGroup
Explore with Pulumi AI
Provides a WAF Rule Group Resource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.waf.Rule("example", {
name: "example",
metricName: "example",
});
const exampleRuleGroup = new aws.waf.RuleGroup("example", {
name: "example",
metricName: "example",
activatedRules: [{
action: {
type: "COUNT",
},
priority: 50,
ruleId: example.id,
}],
});
import pulumi
import pulumi_aws as aws
example = aws.waf.Rule("example",
name="example",
metric_name="example")
example_rule_group = aws.waf.RuleGroup("example",
name="example",
metric_name="example",
activated_rules=[{
"action": {
"type": "COUNT",
},
"priority": 50,
"rule_id": example.id,
}])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/waf"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := waf.NewRule(ctx, "example", &waf.RuleArgs{
Name: pulumi.String("example"),
MetricName: pulumi.String("example"),
})
if err != nil {
return err
}
_, err = waf.NewRuleGroup(ctx, "example", &waf.RuleGroupArgs{
Name: pulumi.String("example"),
MetricName: pulumi.String("example"),
ActivatedRules: waf.RuleGroupActivatedRuleArray{
&waf.RuleGroupActivatedRuleArgs{
Action: &waf.RuleGroupActivatedRuleActionArgs{
Type: pulumi.String("COUNT"),
},
Priority: pulumi.Int(50),
RuleId: example.ID(),
},
},
})
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 example = new Aws.Waf.Rule("example", new()
{
Name = "example",
MetricName = "example",
});
var exampleRuleGroup = new Aws.Waf.RuleGroup("example", new()
{
Name = "example",
MetricName = "example",
ActivatedRules = new[]
{
new Aws.Waf.Inputs.RuleGroupActivatedRuleArgs
{
Action = new Aws.Waf.Inputs.RuleGroupActivatedRuleActionArgs
{
Type = "COUNT",
},
Priority = 50,
RuleId = example.Id,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.waf.Rule;
import com.pulumi.aws.waf.RuleArgs;
import com.pulumi.aws.waf.RuleGroup;
import com.pulumi.aws.waf.RuleGroupArgs;
import com.pulumi.aws.waf.inputs.RuleGroupActivatedRuleArgs;
import com.pulumi.aws.waf.inputs.RuleGroupActivatedRuleActionArgs;
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 example = new Rule("example", RuleArgs.builder()
.name("example")
.metricName("example")
.build());
var exampleRuleGroup = new RuleGroup("exampleRuleGroup", RuleGroupArgs.builder()
.name("example")
.metricName("example")
.activatedRules(RuleGroupActivatedRuleArgs.builder()
.action(RuleGroupActivatedRuleActionArgs.builder()
.type("COUNT")
.build())
.priority(50)
.ruleId(example.id())
.build())
.build());
}
}
resources:
example:
type: aws:waf:Rule
properties:
name: example
metricName: example
exampleRuleGroup:
type: aws:waf:RuleGroup
name: example
properties:
name: example
metricName: example
activatedRules:
- action:
type: COUNT
priority: 50
ruleId: ${example.id}
Create RuleGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RuleGroup(name: string, args: RuleGroupArgs, opts?: CustomResourceOptions);
@overload
def RuleGroup(resource_name: str,
args: RuleGroupArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RuleGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
metric_name: Optional[str] = None,
activated_rules: Optional[Sequence[RuleGroupActivatedRuleArgs]] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None)
func NewRuleGroup(ctx *Context, name string, args RuleGroupArgs, opts ...ResourceOption) (*RuleGroup, error)
public RuleGroup(string name, RuleGroupArgs args, CustomResourceOptions? opts = null)
public RuleGroup(String name, RuleGroupArgs args)
public RuleGroup(String name, RuleGroupArgs args, CustomResourceOptions options)
type: aws:waf:RuleGroup
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 RuleGroupArgs
- 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 RuleGroupArgs
- 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 RuleGroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RuleGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RuleGroupArgs
- 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 awsRuleGroupResource = new Aws.Waf.RuleGroup("awsRuleGroupResource", new()
{
MetricName = "string",
ActivatedRules = new[]
{
new Aws.Waf.Inputs.RuleGroupActivatedRuleArgs
{
Action = new Aws.Waf.Inputs.RuleGroupActivatedRuleActionArgs
{
Type = "string",
},
Priority = 0,
RuleId = "string",
Type = "string",
},
},
Name = "string",
Tags =
{
{ "string", "string" },
},
});
example, err := waf.NewRuleGroup(ctx, "awsRuleGroupResource", &waf.RuleGroupArgs{
MetricName: pulumi.String("string"),
ActivatedRules: waf.RuleGroupActivatedRuleArray{
&waf.RuleGroupActivatedRuleArgs{
Action: &waf.RuleGroupActivatedRuleActionArgs{
Type: pulumi.String("string"),
},
Priority: pulumi.Int(0),
RuleId: pulumi.String("string"),
Type: pulumi.String("string"),
},
},
Name: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var awsRuleGroupResource = new RuleGroup("awsRuleGroupResource", RuleGroupArgs.builder()
.metricName("string")
.activatedRules(RuleGroupActivatedRuleArgs.builder()
.action(RuleGroupActivatedRuleActionArgs.builder()
.type("string")
.build())
.priority(0)
.ruleId("string")
.type("string")
.build())
.name("string")
.tags(Map.of("string", "string"))
.build());
aws_rule_group_resource = aws.waf.RuleGroup("awsRuleGroupResource",
metric_name="string",
activated_rules=[{
"action": {
"type": "string",
},
"priority": 0,
"rule_id": "string",
"type": "string",
}],
name="string",
tags={
"string": "string",
})
const awsRuleGroupResource = new aws.waf.RuleGroup("awsRuleGroupResource", {
metricName: "string",
activatedRules: [{
action: {
type: "string",
},
priority: 0,
ruleId: "string",
type: "string",
}],
name: "string",
tags: {
string: "string",
},
});
type: aws:waf:RuleGroup
properties:
activatedRules:
- action:
type: string
priority: 0
ruleId: string
type: string
metricName: string
name: string
tags:
string: string
RuleGroup 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 RuleGroup resource accepts the following input properties:
- Metric
Name string - A friendly name for the metrics from the rule group
- Activated
Rules List<RuleGroup Activated Rule> - A list of activated rules, see below
- Name string
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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 - A friendly name for the metrics from the rule group
- Activated
Rules []RuleGroup Activated Rule Args - A list of activated rules, see below
- Name string
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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 - A friendly name for the metrics from the rule group
- activated
Rules List<RuleGroup Activated Rule> - A list of activated rules, see below
- name String
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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 - A friendly name for the metrics from the rule group
- activated
Rules RuleGroup Activated Rule[] - A list of activated rules, see below
- name string
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - {[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 - A friendly name for the metrics from the rule group
- activated_
rules Sequence[RuleGroup Activated Rule Args] - A list of activated rules, see below
- name str
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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 - A friendly name for the metrics from the rule group
- activated
Rules List<Property Map> - A list of activated rules, see below
- name String
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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 RuleGroup resource produces the following output properties:
Look up Existing RuleGroup Resource
Get an existing RuleGroup 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?: RuleGroupState, opts?: CustomResourceOptions): RuleGroup
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
activated_rules: Optional[Sequence[RuleGroupActivatedRuleArgs]] = None,
arn: Optional[str] = None,
metric_name: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
tags_all: Optional[Mapping[str, str]] = None) -> RuleGroup
func GetRuleGroup(ctx *Context, name string, id IDInput, state *RuleGroupState, opts ...ResourceOption) (*RuleGroup, error)
public static RuleGroup Get(string name, Input<string> id, RuleGroupState? state, CustomResourceOptions? opts = null)
public static RuleGroup get(String name, Output<String> id, RuleGroupState 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.
- Activated
Rules List<RuleGroup Activated Rule> - A list of activated rules, see below
- Arn string
- The ARN of the WAF rule group.
- Metric
Name string - A friendly name for the metrics from the rule group
- Name string
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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.
- Activated
Rules []RuleGroup Activated Rule Args - A list of activated rules, see below
- Arn string
- The ARN of the WAF rule group.
- Metric
Name string - A friendly name for the metrics from the rule group
- Name string
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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.
- activated
Rules List<RuleGroup Activated Rule> - A list of activated rules, see below
- arn String
- The ARN of the WAF rule group.
- metric
Name String - A friendly name for the metrics from the rule group
- name String
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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.
- activated
Rules RuleGroup Activated Rule[] - A list of activated rules, see below
- arn string
- The ARN of the WAF rule group.
- metric
Name string - A friendly name for the metrics from the rule group
- name string
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - {[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.
- activated_
rules Sequence[RuleGroup Activated Rule Args] - A list of activated rules, see below
- arn str
- The ARN of the WAF rule group.
- metric_
name str - A friendly name for the metrics from the rule group
- name str
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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.
- activated
Rules List<Property Map> - A list of activated rules, see below
- arn String
- The ARN of the WAF rule group.
- metric
Name String - A friendly name for the metrics from the rule group
- name String
- Name of the rule group. If omitted, the provider will assign a random, unique name. Conflicts with
name_prefix
. - 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
RuleGroupActivatedRule, RuleGroupActivatedRuleArgs
- Action
Rule
Group Activated Rule Action - Specifies the action that CloudFront or AWS WAF takes when a web request matches the conditions in the rule.
- Priority int
- Specifies the order in which the rules are evaluated. Rules with a lower value are evaluated before rules with a higher value.
- Rule
Id string - The ID of a rule
- Type string
- Action
Rule
Group Activated Rule Action - Specifies the action that CloudFront or AWS WAF takes when a web request matches the conditions in the rule.
- Priority int
- Specifies the order in which the rules are evaluated. Rules with a lower value are evaluated before rules with a higher value.
- Rule
Id string - The ID of a rule
- Type string
- action
Rule
Group Activated Rule Action - Specifies the action that CloudFront or AWS WAF takes when a web request matches the conditions in the rule.
- priority Integer
- Specifies the order in which the rules are evaluated. Rules with a lower value are evaluated before rules with a higher value.
- rule
Id String - The ID of a rule
- type String
- action
Rule
Group Activated Rule Action - Specifies the action that CloudFront or AWS WAF takes when a web request matches the conditions in the rule.
- priority number
- Specifies the order in which the rules are evaluated. Rules with a lower value are evaluated before rules with a higher value.
- rule
Id string - The ID of a rule
- type string
- action
Rule
Group Activated Rule Action - Specifies the action that CloudFront or AWS WAF takes when a web request matches the conditions in the rule.
- priority int
- Specifies the order in which the rules are evaluated. Rules with a lower value are evaluated before rules with a higher value.
- rule_
id str - The ID of a rule
- type str
- action Property Map
- Specifies the action that CloudFront or AWS WAF takes when a web request matches the conditions in the rule.
- priority Number
- Specifies the order in which the rules are evaluated. Rules with a lower value are evaluated before rules with a higher value.
- rule
Id String - The ID of a rule
- type String
RuleGroupActivatedRuleAction, RuleGroupActivatedRuleActionArgs
- Type string
- Type string
- type String
- type string
- type str
- type String
Import
Using pulumi import
, import WAF Rule Group using the id. For example:
$ pulumi import aws:waf/ruleGroup:RuleGroup example 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.