Skip to content

Commit b50a708

Browse files
authored
Merge pull request #327 from DFE-Digital/tf-override-host-header
Set override option for CDN Origin Hostname and Host Header
2 parents c7c5343 + 17f4a09 commit b50a708

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

terraform/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ No resources.
152152
| <a name="input_cdn_frontdoor_enable_rate_limiting"></a> [cdn\_frontdoor\_enable\_rate\_limiting](#input\_cdn\_frontdoor\_enable\_rate\_limiting) | Enable CDN Front Door Rate Limiting. This will create a WAF policy, and CDN security policy. For pricing reasons, there will only be one WAF policy created. | `bool` | n/a | yes |
153153
| <a name="input_cdn_frontdoor_health_probe_path"></a> [cdn\_frontdoor\_health\_probe\_path](#input\_cdn\_frontdoor\_health\_probe\_path) | Specifies the path relative to the origin that is used to determine the health of the origin. | `string` | n/a | yes |
154154
| <a name="input_cdn_frontdoor_host_add_response_headers"></a> [cdn\_frontdoor\_host\_add\_response\_headers](#input\_cdn\_frontdoor\_host\_add\_response\_headers) | List of response headers to add at the CDN Front Door `[{ "Name" = "Strict-Transport-Security", "value" = "max-age=31536000" }]` | `list(map(string))` | n/a | yes |
155+
| <a name="input_cdn_frontdoor_origin_fqdn_override"></a> [cdn\_frontdoor\_origin\_fqdn\_override](#input\_cdn\_frontdoor\_origin\_fqdn\_override) | Manually specify the hostname that the CDN Front Door should target. Defaults to the Container App FQDN | `string` | `""` | no |
156+
| <a name="input_cdn_frontdoor_origin_host_header_override"></a> [cdn\_frontdoor\_origin\_host\_header\_override](#input\_cdn\_frontdoor\_origin\_host\_header\_override) | Manually specify the host header that the CDN sends to the target. Defaults to the recieved host header. Set to null to set it to the host\_name (`cdn_frontdoor_origin_fqdn_override`) | `string` | `""` | no |
155157
| <a name="input_container_command"></a> [container\_command](#input\_container\_command) | Container command | `list(any)` | n/a | yes |
156158
| <a name="input_container_health_probe_path"></a> [container\_health\_probe\_path](#input\_container\_health\_probe\_path) | Specifies the path that is used to determine the liveness of the Container | `string` | n/a | yes |
157159
| <a name="input_container_secret_environment_variables"></a> [container\_secret\_environment\_variables](#input\_container\_secret\_environment\_variables) | Container secret environment variables | `map(string)` | n/a | yes |

terraform/container-apps-hosting.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ module "azure_container_apps_hosting" {
1919
container_command = local.container_command
2020
container_secret_environment_variables = local.container_secret_environment_variables
2121

22-
enable_cdn_frontdoor = local.enable_cdn_frontdoor
23-
cdn_frontdoor_enable_rate_limiting = local.cdn_frontdoor_enable_rate_limiting
24-
cdn_frontdoor_host_add_response_headers = local.cdn_frontdoor_host_add_response_headers
25-
cdn_frontdoor_custom_domains = local.cdn_frontdoor_custom_domains
22+
enable_cdn_frontdoor = local.enable_cdn_frontdoor
23+
cdn_frontdoor_enable_rate_limiting = local.cdn_frontdoor_enable_rate_limiting
24+
cdn_frontdoor_host_add_response_headers = local.cdn_frontdoor_host_add_response_headers
25+
cdn_frontdoor_custom_domains = local.cdn_frontdoor_custom_domains
26+
cdn_frontdoor_origin_fqdn_override = local.cdn_frontdoor_origin_fqdn_override
27+
cdn_frontdoor_origin_host_header_override = local.cdn_frontdoor_origin_host_header_override
2628

2729
enable_event_hub = local.enable_event_hub
2830

terraform/locals.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ locals {
2222
cdn_frontdoor_enable_rate_limiting = var.cdn_frontdoor_enable_rate_limiting
2323
cdn_frontdoor_host_add_response_headers = var.cdn_frontdoor_host_add_response_headers
2424
cdn_frontdoor_custom_domains = var.cdn_frontdoor_custom_domains
25+
cdn_frontdoor_origin_fqdn_override = var.cdn_frontdoor_origin_fqdn_override
26+
cdn_frontdoor_origin_host_header_override = var.cdn_frontdoor_origin_host_header_override
2527
container_health_probe_path = var.container_health_probe_path
2628
cdn_frontdoor_health_probe_path = var.cdn_frontdoor_health_probe_path
2729
monitor_endpoint_healthcheck = var.monitor_endpoint_healthcheck

terraform/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ variable "container_health_probe_path" {
119119
type = string
120120
}
121121

122+
variable "cdn_frontdoor_origin_fqdn_override" {
123+
description = "Manually specify the hostname that the CDN Front Door should target. Defaults to the Container App FQDN"
124+
type = string
125+
default = ""
126+
}
127+
128+
variable "cdn_frontdoor_origin_host_header_override" {
129+
description = "Manually specify the host header that the CDN sends to the target. Defaults to the recieved host header. Set to null to set it to the host_name (`cdn_frontdoor_origin_fqdn_override`)"
130+
type = string
131+
default = ""
132+
}
133+
122134
variable "cdn_frontdoor_health_probe_path" {
123135
description = "Specifies the path relative to the origin that is used to determine the health of the origin."
124136
type = string

0 commit comments

Comments
 (0)