Skip to content

Commit 9cf65cc

Browse files
feat: Support http respond headers for ALB listeners (#398)
Co-authored-by: Bryant Biggs <[email protected]>
1 parent 46ec742 commit 9cf65cc

File tree

15 files changed

+55
-18
lines changed

15 files changed

+55
-18
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.96.1
3+
rev: v1.97.4
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_wrapper_module_for_each

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ See [patterns.md](https://github.com/terraform-aws-modules/terraform-aws-alb/blo
352352
| Name | Version |
353353
|------|---------|
354354
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
355-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82 |
355+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.89 |
356356

357357
## Providers
358358

359359
| Name | Version |
360360
|------|---------|
361-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.82 |
361+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.89 |
362362

363363
## Modules
364364

examples/complete-alb/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.89 |
2424
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.6 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.82 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.89 |
3232
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3333
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.6 |
3434

examples/complete-alb/main.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,31 @@ module "alb" {
359359
target_group_key = "ex-instance"
360360
}
361361
}
362+
363+
ex-response-headers = {
364+
port = "443"
365+
protocol = "HTTPS"
366+
ssl_policy = "ELBSecurityPolicy-TLS13-1-2-Res-2021-06"
367+
certificate_arn = module.acm.acm_certificate_arn
368+
369+
fixed_response = {
370+
content_type = "text/plain"
371+
message_body = "Fixed message"
372+
status_code = "200"
373+
}
374+
375+
routing_http_response_server_enabled = false
376+
routing_http_response_strict_transport_security_header_value = "max-age=31536000; includeSubDomains; preload"
377+
routing_http_response_access_control_allow_origin_header_value = "https://example.com"
378+
routing_http_response_access_control_allow_methods_header_value = "TRACE,GET"
379+
routing_http_response_access_control_allow_headers_header_value = "Accept-Language,Content-Language"
380+
routing_http_response_access_control_allow_credentials_header_value = "true"
381+
routing_http_response_access_control_expose_headers_header_value = "Cache-Control"
382+
routing_http_response_access_control_max_age_header_value = 86400
383+
routing_http_response_content_security_policy_header_value = "*"
384+
routing_http_response_x_content_type_options_header_value = "nosniff"
385+
routing_http_response_x_frame_options_header_value = "SAMEORIGIN"
386+
}
362387
}
363388

364389
target_groups = {

examples/complete-alb/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.82"
7+
version = ">= 5.89"
88
}
99
null = {
1010
source = "hashicorp/null"

examples/complete-nlb/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.89 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.82 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.89 |
3030

3131
## Modules
3232

examples/complete-nlb/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.82"
7+
version = ">= 5.89"
88
}
99
}
1010
}

examples/mutual-auth-alb/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Note that this example may create resources which cost money. Run `terraform des
2121
| Name | Version |
2222
|------|---------|
2323
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
24-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82 |
24+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.89 |
2525
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2626
| <a name="requirement_tls"></a> [tls](#requirement\_tls) | >= 4.0 |
2727

2828
## Providers
2929

3030
| Name | Version |
3131
|------|---------|
32-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.82 |
32+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.89 |
3333
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3434
| <a name="provider_tls"></a> [tls](#provider\_tls) | >= 4.0 |
3535

examples/mutual-auth-alb/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.82"
7+
version = ">= 5.89"
88
}
99
null = {
1010
source = "hashicorp/null"

main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@ resource "aws_lb_listener" "this" {
217217
}
218218
}
219219

220+
routing_http_response_server_enabled = try(each.value.routing_http_response_server_enabled, null)
221+
routing_http_response_strict_transport_security_header_value = try(each.value.routing_http_response_strict_transport_security_header_value, null)
222+
routing_http_response_access_control_allow_origin_header_value = try(each.value.routing_http_response_access_control_allow_origin_header_value, null)
223+
routing_http_response_access_control_allow_methods_header_value = try(each.value.routing_http_response_access_control_allow_methods_header_value, null)
224+
routing_http_response_access_control_allow_headers_header_value = try(each.value.routing_http_response_access_control_allow_headers_header_value, null)
225+
routing_http_response_access_control_allow_credentials_header_value = try(each.value.routing_http_response_access_control_allow_credentials_header_value, null)
226+
routing_http_response_access_control_expose_headers_header_value = try(each.value.routing_http_response_access_control_expose_headers_header_value, null)
227+
routing_http_response_access_control_max_age_header_value = try(each.value.routing_http_response_access_control_max_age_header_value, null)
228+
routing_http_response_content_security_policy_header_value = try(each.value.routing_http_response_content_security_policy_header_value, null)
229+
routing_http_response_x_content_type_options_header_value = try(each.value.routing_http_response_x_content_type_options_header_value, null)
230+
routing_http_response_x_frame_options_header_value = try(each.value.routing_http_response_x_frame_options_header_value, null)
231+
220232
load_balancer_arn = aws_lb.this[0].arn
221233
port = try(each.value.port, var.default_port)
222234
protocol = try(each.value.protocol, var.default_protocol)

0 commit comments

Comments
 (0)