Skip to content

Commit

Permalink
Add new trs domains
Browse files Browse the repository at this point in the history
  • Loading branch information
johnake committed Apr 23, 2024
1 parent 3aaf1d7 commit d775912
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 59 deletions.
43 changes: 39 additions & 4 deletions terraform/domains/environment_domains/config/dev.tfvars.json
Original file line number Diff line number Diff line change
@@ -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"
}

}
}
38 changes: 28 additions & 10 deletions terraform/domains/environment_domains/main.tf
Original file line number Diff line number Diff line change
@@ -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

}
90 changes: 45 additions & 45 deletions terraform/domains/environment_domains/variables.tf
Original file line number Diff line number Diff line change
@@ -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}"
# }

0 comments on commit d775912

Please sign in to comment.