WAF
Terraform module to create AWS WAF v2 resources
Inputs
23
association_configoptionalmap(object({ default_size_inspection_limit = string }))Configuration for body inspection size limits per resource type. Keys are resource types (e.g., `CLOUDFRONT`, `API_GATEWAY`, `COGNITO_USER_POOL`, `APP_RUNNER_SERVICE`, `VERIFIED_ACCESS_INSTANCE`)
{}association_resource_arnsoptionalmap(string)Map of resource ARNs to associate with the Web ACL. Key is a friendly name, value is the resource ARN
{}captcha_configoptionalobject({ immunity_time_property = object({ immunity_time = number }) })CAPTCHA configuration for the Web ACL. Specifies how long a CAPTCHA timestamp is considered valid
nullchallenge_configoptionalobject({ immunity_time_property = object({ immunity_time = number }) })Challenge configuration for the Web ACL. Specifies how long a challenge timestamp is considered valid
nullcreateoptionalboolControls if resources should be created (affects all resources)
truecreate_logging_configurationoptionalboolControls if a logging configuration should be created for the Web ACL
falsecustom_response_bodiesoptionalmap(object({ content = string content_type = string }))Map of custom response body configurations. Key is the reference key, used in custom responses
{}data_protection_configoptionalanyData protection configuration. `data_protections` is a list of objects with `field` (object with `field_keys` list and `field_type` one of `SINGLE_HEADER`/`SINGLE_COOKIE`/`SINGLE_QUERY_ARGUMENT`/`QUERY_STRING`/`BODY`), `action` (`HASH` or `SUBSTITUTION`), `exclude_rate_based_details` (bool, optional…
nulldefault_actionoptionalanyAction to perform if none of the rules contained in the Web ACL match. Use `allow` or `block` for simple actions, or provide an object for custom request handling/response. See examples for object structure
allowdescriptionoptionalstringA friendly description of the Web ACL
nulllogging_filteroptionalobject({ default_behavior = string filters = list(object({ behavior = string req…A configuration block that specifies which web requests are kept in the logs and which are dropped
nulllogging_log_destination_configsoptionallist(string)The Amazon Kinesis Data Firehose, CloudWatch Log Group, or S3 Bucket ARNs for the logging destination. Names must be prefixed with `aws-waf-logs-`
[]logging_redacted_fieldsoptionallist(object({ method = optional(object({})) query_string = optional(object({})) …The parts of the request that you want to keep out of the logs. Each entry must specify exactly one of `method`, `query_string`, `uri_path`, or `single_header`
[]logging_regionoptionalstringRegion where the WAF logging configuration will be managed. Defaults to the provider region
nullnameoptionalstringA friendly name of the Web ACL. Mutually exclusive with `name_prefix`
nullname_prefixoptionalstringCreates a unique name beginning with the specified prefix. Mutually exclusive with `name` (provider rejects both being set at apply time)
nullputin_khuylooptionalboolDo you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Russian_invasion_of_Ukraine
truerule_jsonoptionalstringEscape hatch: JSON string of WAF rules for cases where dynamic blocks cannot represent all provider features. Mutually exclusive with `rules`
nullrulesoptionalanyMap of WAF rule configurations. The key is used as the rule name. Each rule supports: - `priority` - (Required) Rule priority (lower = evaluated first) - `action` - Action for standalone rules. Use string (`allow`, `block`, `count`, `captcha`, `challenge`) or object for custom response - `override_a…
{}scopeoptionalstringSpecifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`
REGIONALtagsoptionalmap(string)A map of tags to add to all resources
{}token_domainsoptionallist(string)Specifies the domains that AWS WAF should accept in a web request token. Enables token use across multiple protected resources
[]visibility_configoptionalobject({ cloudwatch_metrics_enabled = optional(bool, true) metric_name = optiona…Visibility configuration for the Web ACL. Defines CloudWatch metrics configuration
{}All 23 are optional — the module deploys with none of them set.
Outputs
12
logging_configuration_idThe ID of the WAF logging configuration
web_acl_application_integration_urlThe URL to use in SDK integrations with managed rule groups
web_acl_arnThe ARN of the Web ACL
web_acl_association_idsMap of Web ACL association IDs
web_acl_capacityWeb ACL capacity units (WCUs) currently being used by this Web ACL
web_acl_descriptionThe description of the Web ACL
web_acl_idThe ID of the Web ACL
web_acl_lock_tokenA token used for optimistic locking
web_acl_nameThe name of the Web ACL
web_acl_rule_namesList of rule names in the Web ACL
web_acl_tags_allA map of tags assigned to the resource, including those inherited from the provider default_tags configuration block
web_acl_visibility_configThe visibility configuration of the Web ACL
What the agent wires into the next module. An edge on the architecture diagram is one of these consumed by something else.