Skip to content

Commit

Permalink
Merge pull request #139 from DFE-Digital/2183-npq-domains
Browse files Browse the repository at this point in the history
[2183] Allow 1 character custom domains length
  • Loading branch information
saliceti authored Dec 11, 2024
2 parents 8dc1508 + 435d3ca commit 440927a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion domains/environment_domains/front_door.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "azurerm_cdn_frontdoor_origin" "main" {

resource "azurerm_cdn_frontdoor_custom_domain" "main" {
for_each = toset(var.domains)
name = replace(each.key, ".", "-")
name = length(each.key) > 1 ? replace(each.key, ".", "-") : "${replace(each.key, ".", "-")}-domain"
cdn_frontdoor_profile_id = data.azurerm_cdn_frontdoor_profile.main.id
dns_zone_id = data.azurerm_dns_zone.main.id
host_name = startswith(each.key, "apex") ? var.zone : "${each.key}.${var.zone}"
Expand Down
2 changes: 1 addition & 1 deletion domains/environment_domains/tfdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cached_paths"></a> [cached\_paths](#input\_cached\_paths) | List of path patterns such as /packs/* that front door will cache | `list(string)` | `[]` | no |
| <a name="input_domains"></a> [domains](#input\_domains) | List of subdomains of the zone e.g. "staging". For apex domain use "apex" or "apex<something>" if apex is already in use | `any` | n/a | yes |
| <a name="input_domains"></a> [domains](#input\_domains) | List of subdomains of the zone e.g. "staging". For apex domain use "apex" or "apex<something>" if apex is already in use.<br/> The length of "<domain>.<zone>" cannot exceed 64 characters. | `any` | n/a | yes |
| <a name="input_environment"></a> [environment](#input\_environment) | n/a | `any` | n/a | yes |
| <a name="input_exclude_cnames"></a> [exclude\_cnames](#input\_exclude\_cnames) | Don't create the CNAME for this record from var.domains. We set this when we want to configure front door for a services domain that we are migrating so we do not need to wait for the certificate to validate and front door to propagate the configuration. | `list` | `[]` | no |
| <a name="input_front_door_name"></a> [front\_door\_name](#input\_front\_door\_name) | n/a | `any` | n/a | yes |
Expand Down
3 changes: 2 additions & 1 deletion domains/environment_domains/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ variable "front_door_name" {}
variable "resource_group_name" {}
variable "domains" {
description = <<EOF
List of subdomains of the zone e.g. "staging". For apex domain use "apex" or "apex<something>" if apex is already in use
List of subdomains of the zone e.g. "staging". For apex domain use "apex" or "apex<something>" if apex is already in use.
The length of "<domain>.<zone>" cannot exceed 64 characters.
EOF
}
variable "environment" {}
Expand Down

0 comments on commit 440927a

Please sign in to comment.