Skip to content

Commit

Permalink
Passthrough default block response (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Fuhrmeister authored Oct 5, 2023
1 parent 5c63af5 commit 51b5952
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/waf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ components:
| Name | Source | Version |
|------|--------|---------|
| <a name="module_association_resource_components"></a> [association\_resource\_components](#module\_association\_resource\_components) | cloudposse/stack-config/yaml//modules/remote-state | 1.5.0 |
| <a name="module_aws_waf"></a> [aws\_waf](#module\_aws\_waf) | cloudposse/waf/aws | 1.2.0 |
| <a name="module_aws_waf"></a> [aws\_waf](#module\_aws\_waf) | cloudposse/waf/aws | 1.3.0 |
| <a name="module_iam_roles"></a> [iam\_roles](#module\_iam\_roles) | ../account-map/modules/iam-roles | n/a |
| <a name="module_log_destination_components"></a> [log\_destination\_components](#module\_log\_destination\_components) | cloudposse/stack-config/yaml//modules/remote-state | 1.5.0 |
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
Expand All @@ -82,6 +82,7 @@ components:
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
| <a name="input_custom_response_body"></a> [custom\_response\_body](#input\_custom\_response\_body) | Defines custom response bodies that can be referenced by custom\_response actions.<br>The map keys are used as the `key` attribute which is a unique key identifying the custom response body.<br>content:<br> Payload of the custom response.<br> The response body can be plain text, HTML or JSON and cannot exceed 4KB in size.<br>content\_type:<br> Content Type of Response Body.<br> Valid values are `TEXT_PLAIN`, `TEXT_HTML`, or `APPLICATION_JSON`. | <pre>map(object({<br> content = string<br> content_type = string<br> }))</pre> | `{}` | no |
| <a name="input_default_action"></a> [default\_action](#input\_default\_action) | Specifies that AWS WAF should allow requests by default. Possible values: `allow`, `block`. | `string` | `"block"` | no |
| <a name="input_default_block_response"></a> [default\_block\_response](#input\_default\_block\_response) | A HTTP response code that is sent when default action is used. Only takes effect if default\_action is set to `block`. | `string` | `null` | no |
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
| <a name="input_description"></a> [description](#input\_description) | A friendly description of the WebACL. | `string` | `"Managed by Terraform"` | no |
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/waf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ locals {

module "aws_waf" {
source = "cloudposse/waf/aws"
version = "1.2.0"
version = "1.3.0"

description = var.description
default_action = var.default_action
Expand Down Expand Up @@ -48,6 +48,7 @@ module "aws_waf" {
size_constraint_statement_rules = var.size_constraint_statement_rules
sqli_match_statement_rules = var.sqli_match_statement_rules
xss_match_statement_rules = var.xss_match_statement_rules
default_block_response = var.default_block_response

context = module.this.context
}
Expand Down
9 changes: 9 additions & 0 deletions modules/waf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ variable "default_action" {
}
}

variable "default_block_response" {
type = string
default = null
description = <<-DOC
A HTTP response code that is sent when default action is used. Only takes effect if default_action is set to `block`.
DOC
nullable = true
}

variable "custom_response_body" {
type = map(object({
content = string
Expand Down

0 comments on commit 51b5952

Please sign in to comment.