diff --git a/terraform/domains/environment_domains/config/dev.tfvars.json b/terraform/domains/environment_domains/config/dev.tfvars.json index 22aa6e312..9a4833ff0 100644 --- a/terraform/domains/environment_domains/config/dev.tfvars.json +++ b/terraform/domains/environment_domains/config/dev.tfvars.json @@ -1,6 +1,41 @@ { - "domains": ["dev"], - "environment_short": "dv", - "environment_tag": "dev", - "origin_hostname": "trs-dev-api.test.teacherservices.cloud" + "hosted_zone": { + "teacher-qualifications-api.education.gov.uk": { + "front_door_name": "s189p01-trsdomains-fd", + "resource_group_name": "s189p01-trsdomains-rg", + "domains": [ + "dev" + ], + "cached_paths": [ + "/assets/*" + ], + "environment_short": "dv", + "origin_hostname": "trs-dev-api.test.teacherservices.cloud" + }, + "authorise-access-to-a-teaching-record.education.gov.uk": { + "front_door_name": "s189p01-trsdomains-fd", + "resource_group_name": "s189p01-trsdomains-rg", + "domains": [ + "dev" + ], + "cached_paths": [ + "/assets/*" + ], + "environment_short": "dv", + "origin_hostname": "trs-dev-authz.test.teacherservices.cloud" + }, + "teaching-record-system.education.gov.uk": { + "front_door_name": "s189p01-trsdomains-fd", + "resource_group_name": "s189p01-trsdomains-rg", + "domains": [ + "dev" + ], + "cached_paths": [ + "/assets/*" + ], + "environment_short": "dv", + "origin_hostname": "trs-dev-ui.test.teacherservices.cloud" + } + + } } diff --git a/terraform/domains/environment_domains/main.tf b/terraform/domains/environment_domains/main.tf index 6d104c4a7..ea01591cd 100644 --- a/terraform/domains/environment_domains/main.tf +++ b/terraform/domains/environment_domains/main.tf @@ -1,15 +1,33 @@ +# module "domains" { +# source = "./vendor/modules/domains//domains/environment_domains" +# zone = var.zone +# front_door_name = var.front_door_name +# resource_group_name = var.resource_group_name +# domains = var.domains +# environment = var.environment_short +# host_name = var.origin_hostname +# null_host_header = var.null_host_header +# } +# module "records" { +# source = "./vendor/modules/domains//dns/records" +# hosted_zone = var.hosted_zone + +# } + module "domains" { - source = "./vendor/modules/domains//domains/environment_domains" - zone = var.zone - front_door_name = var.front_door_name - resource_group_name = var.resource_group_name - domains = var.domains - environment = var.environment_short - host_name = var.origin_hostname - null_host_header = var.null_host_header + for_each = var.hosted_zone + source = "git::https://github.com/DFE-Digital/terraform-modules.git//domains/environment_domains?ref=stable" + zone = each.key + front_door_name = each.value.front_door_name + resource_group_name = each.value.resource_group_name + domains = each.value.domains + environment = each.value.environment_short + host_name = each.value.origin_hostname + null_host_header = try(each.value.null_host_header, false) + cached_paths = try(each.value.cached_paths, []) } -module "records" { + +module "dns_records" { source = "./vendor/modules/domains//dns/records" hosted_zone = var.hosted_zone - } diff --git a/terraform/domains/environment_domains/variables.tf b/terraform/domains/environment_domains/variables.tf index cc8924b02..aaaa3347e 100644 --- a/terraform/domains/environment_domains/variables.tf +++ b/terraform/domains/environment_domains/variables.tf @@ -1,51 +1,51 @@ -variable "zone" { - type = string - description = "Name of DNS zone" - default = "teacher-qualifications-api.education.gov.uk" -} - -variable "front_door_name" { - type = string - description = "Name of Azure Front Door" - default = "s189p01-trsdomains-fd" -} - -variable "resource_group_name" { - type = string - description = "Name of resouce group name" - default = "s189p01-trsdomains-rg" -} - -variable "domains" { - description = "List of domains record names" -} - -variable "environment_tag" { - type = string - description = "Environment" -} - -variable "environment_short" { - type = string - description = "Short name for environment" -} - -variable "origin_hostname" { - type = string - description = "Origin endpoint url" -} - -variable "null_host_header" { - type = bool - description = "origin_host_header for the azurerm_cdn_frontdoor_origin" - default = false -} +# variable "zone" { +# type = string +# description = "Name of DNS zone" +# default = "teacher-qualifications-api.education.gov.uk" +# } + +# variable "front_door_name" { +# type = string +# description = "Name of Azure Front Door" +# default = "s189p01-trsdomains-fd" +# } + +# variable "resource_group_name" { +# type = string +# description = "Name of resouce group name" +# default = "s189p01-trsdomains-rg" +# } + +# variable "domains" { +# description = "List of domains record names" +# } + +# variable "environment_tag" { +# type = string +# description = "Environment" +# } + +# variable "environment_short" { +# type = string +# description = "Short name for environment" +# } + +# variable "origin_hostname" { +# type = string +# description = "Origin endpoint url" +# } + +# variable "null_host_header" { +# type = bool +# description = "origin_host_header for the azurerm_cdn_frontdoor_origin" +# default = false +#} variable "hosted_zone" { type = map(any) default = {} } -locals { - hostname = "${var.domains[0]}.${var.zone}" -} +# locals { +# hostname = "${var.domains[0]}.${var.zone}" +# }