Package com.pulumi.aws.waf
Class WebAcl
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.waf.WebAcl
-
public class WebAcl extends com.pulumi.resources.CustomResourceProvides a WAF Web ACL Resource ## Example Usage This example blocks requests coming from `192.0.7.0/24` and allows everything else.
### Logging > *NOTE:* The Kinesis Firehose Delivery Stream name must begin with `aws-waf-logs-` and be located in `us-east-1` region. See the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/logging.html) for more information about enabling WAF logging.package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.waf.IpSet; import com.pulumi.aws.waf.IpSetArgs; import com.pulumi.aws.waf.inputs.IpSetIpSetDescriptorArgs; import com.pulumi.aws.waf.Rule; import com.pulumi.aws.waf.RuleArgs; import com.pulumi.aws.waf.inputs.RulePredicateArgs; import com.pulumi.aws.waf.WebAcl; import com.pulumi.aws.waf.WebAclArgs; import com.pulumi.aws.waf.inputs.WebAclDefaultActionArgs; import com.pulumi.aws.waf.inputs.WebAclRuleArgs; import com.pulumi.aws.waf.inputs.WebAclRuleActionArgs; import com.pulumi.resources.CustomResourceOptions; import java.util.ArrayList; import java.util.Arrays; 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() .ipSetDescriptors(IpSetIpSetDescriptorArgs.builder() .type("IPV4") .value("192.0.7.0/24") .build()) .name("tfIPSet") .build()); var wafrule = new Rule("wafrule", RuleArgs.builder() .predicates(RulePredicateArgs.builder() .dataId(ipset.id()) .negated(false) .type("IPMatch") .build()) .name("tfWAFRule") .metricName("tfWAFRule") .build(), CustomResourceOptions.builder() .dependsOn(ipset) .build()); var wafAcl = new WebAcl("wafAcl", WebAclArgs.builder() .defaultAction(WebAclDefaultActionArgs.builder() .type("ALLOW") .build()) .rules(WebAclRuleArgs.builder() .action(WebAclRuleActionArgs.builder() .type("BLOCK") .build()) .priority(1) .ruleId(wafrule.id()) .type("REGULAR") .build()) .name("tfWebACL") .metricName("tfWebACL") .build(), CustomResourceOptions.builder() .dependsOn( ipset, wafrule) .build()); } }
## Import Using `pulumi import`, import WAF Web ACL using the `id`. For example: ```sh $ pulumi import aws:waf/webAcl:WebAcl main 0c8e583e-18f3-4c13-9e2a-67c4805d2f94 ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.waf.WebAcl; import com.pulumi.aws.waf.WebAclArgs; import com.pulumi.aws.waf.inputs.WebAclLoggingConfigurationArgs; import com.pulumi.aws.waf.inputs.WebAclLoggingConfigurationRedactedFieldsArgs; import com.pulumi.aws.waf.inputs.WebAclLoggingConfigurationRedactedFieldsFieldToMatchArgs; import java.util.ArrayList; import java.util.Arrays; 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 WebAcl("example", WebAclArgs.builder() .loggingConfiguration(WebAclLoggingConfigurationArgs.builder() .redactedFields(WebAclLoggingConfigurationRedactedFieldsArgs.builder() .fieldToMatches( WebAclLoggingConfigurationRedactedFieldsFieldToMatchArgs.builder() .type("URI") .build(), WebAclLoggingConfigurationRedactedFieldsFieldToMatchArgs.builder() .data("referer") .type("HEADER") .build()) .build()) .logDestination(exampleAwsKinesisFirehoseDeliveryStream.arn()) .build()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description WebAcl(java.lang.String name)WebAcl(java.lang.String name, WebAclArgs args)WebAcl(java.lang.String name, WebAclArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<WebAclDefaultAction>defaultAction()static WebAclget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, WebAclState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<WebAclLoggingConfiguration>>loggingConfiguration()com.pulumi.core.Output<java.lang.String>metricName()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.util.Optional<java.util.List<WebAclRule>>>rules()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()
-
-
-
Constructor Detail
-
WebAcl
public WebAcl(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
WebAcl
public WebAcl(java.lang.String name, WebAclArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
WebAcl
public WebAcl(java.lang.String name, WebAclArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- The ARN of the WAF WebACL.
-
defaultAction
public com.pulumi.core.Output<WebAclDefaultAction> defaultAction()
- Returns:
- Configuration block with action that you want AWS WAF to take when a request doesn't match the criteria in any of the rules that are associated with the web ACL. Detailed below.
-
loggingConfiguration
public com.pulumi.core.Output<java.util.Optional<WebAclLoggingConfiguration>> loggingConfiguration()
- Returns:
- Configuration block to enable WAF logging. Detailed below.
-
metricName
public com.pulumi.core.Output<java.lang.String> metricName()
- Returns:
- The name or description for the Amazon CloudWatch metric of this web ACL.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- The name or description of the web ACL.
-
rules
public com.pulumi.core.Output<java.util.Optional<java.util.List<WebAclRule>>> rules()
- Returns:
- Configuration blocks containing rules to associate with the web ACL and the settings for each rule. Detailed below.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
get
public static WebAcl get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable WebAclState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-