Skip to content

Commit

Permalink
Merge pull request #7641 from ministryofjustice/RST-6829-tribunals-de…
Browse files Browse the repository at this point in the history
…legate-dns-patch

Fix logic of using substring to split the www_instances by removing th…
  • Loading branch information
mark-butler-solirius authored Aug 30, 2024
2 parents d5f1069 + b4804b2 commit 3c8aaf4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
19 changes: 16 additions & 3 deletions terraform/environments/tribunals/dns-delegate-route53.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ locals {
"www.consumercreditappeals",
"www.estateagentappeals",
"www.fhsaa",
"www.siac",
"www"
"www.siac"
]

production_zone_id = data.aws_route53_zone.production_zone.zone_id
Expand Down Expand Up @@ -99,7 +98,21 @@ resource "aws_route53_record" "www_instances" {
type = "A"

alias {
name = substr(local.www_records[count.index], 4, -1)
name = format("%s.tribunals.gov.uk",substr(local.www_records[count.index], 4, -1))
zone_id = local.production_zone_id
evaluate_target_health = false
}
}

# The root www resource record needs its own resource to avoid breaking the logic of using the substring in www_instances
resource "aws_route53_record" "www_root" {
provider = aws.core-network-services
zone_id = local.production_zone_id
name = "www"
type = "A"

alias {
name = "tribunals.gov.uk"
zone_id = local.production_zone_id
evaluate_target_health = false
}
Expand Down
2 changes: 2 additions & 0 deletions terraform/environments/tribunals/platform_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ data "aws_region" "current" {}

data "aws_caller_identity" "current" {}



# VPC and subnet data
data "aws_vpc" "shared" {
tags = {
Expand Down
5 changes: 5 additions & 0 deletions terraform/environments/tribunals/platform_providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ provider "aws" {
role_arn = "arn:aws:iam::${local.environment_management.aws_organizations_root_account_id}:role/ModernisationPlatformSSOReadOnly"
}
}
# Configure the GitHub Provider to use 6.2.2 (6.2.3 seems to have a bug)
# https://github.com/integrations/terraform-provider-github/issues/2357
provider "github" {
version = "6.2.2"
}

0 comments on commit 3c8aaf4

Please sign in to comment.