From eafeb7088a1937f84f651cf027615bd9ac35149a Mon Sep 17 00:00:00 2001 From: aidenvaines-bjss Date: Mon, 5 Aug 2024 11:15:02 +0100 Subject: [PATCH 1/4] CCM-5680 Support dedicated dev env branches --- .../terraform/components/branch/locals.tf | 3 +++ .../components/branch/locals_remote_state.tf | 19 ------------------- .../branch/module_amplify_branch.tf | 2 +- .../terraform/components/iam/outputs.tf | 1 + 4 files changed, 5 insertions(+), 20 deletions(-) create mode 100644 infrastructure/terraform/components/branch/locals.tf diff --git a/infrastructure/terraform/components/branch/locals.tf b/infrastructure/terraform/components/branch/locals.tf new file mode 100644 index 0000000..0b78a0a --- /dev/null +++ b/infrastructure/terraform/components/branch/locals.tf @@ -0,0 +1,3 @@ +locals { + dns_prefix = "${var.environment}.${local.acct.dns_zone["name"]}" +} diff --git a/infrastructure/terraform/components/branch/locals_remote_state.tf b/infrastructure/terraform/components/branch/locals_remote_state.tf index bc45071..c0ed65b 100644 --- a/infrastructure/terraform/components/branch/locals_remote_state.tf +++ b/infrastructure/terraform/components/branch/locals_remote_state.tf @@ -1,6 +1,5 @@ locals { bootstrap = data.terraform_remote_state.bootstrap.outputs - acct = data.terraform_remote_state.acct.outputs iam = data.terraform_remote_state.iam.outputs } @@ -22,24 +21,6 @@ data "terraform_remote_state" "bootstrap" { } } -data "terraform_remote_state" "acct" { - backend = "s3" - - config = { - bucket = local.terraform_state_bucket - - key = format( - "%s/%s/%s/%s/acct.tfstate", - var.project, - var.aws_account_id, - "eu-west-2", - "main" - ) - - region = "eu-west-2" - } -} - data "terraform_remote_state" "iam" { backend = "s3" diff --git a/infrastructure/terraform/components/branch/module_amplify_branch.tf b/infrastructure/terraform/components/branch/module_amplify_branch.tf index 8a1b83d..2737e90 100644 --- a/infrastructure/terraform/components/branch/module_amplify_branch.tf +++ b/infrastructure/terraform/components/branch/module_amplify_branch.tf @@ -13,6 +13,6 @@ module "amplify_branch" { cognito_user_pool_identity_provider_names = local.iam.cognito_user_pool["identity_providers"] amplify_app_id = local.iam.amplify["id"] branch = var.branch_name - domain_name = local.dns_prefix + domain_name = local.iam.amplify["domain_name"] subdomain = var.environment } diff --git a/infrastructure/terraform/components/iam/outputs.tf b/infrastructure/terraform/components/iam/outputs.tf index e64a4c9..3b39607 100644 --- a/infrastructure/terraform/components/iam/outputs.tf +++ b/infrastructure/terraform/components/iam/outputs.tf @@ -14,5 +14,6 @@ output "cognito_user_pool_client" { output "amplify" { value = { id = aws_amplify_app.main.id + domain_name = local.dns_prefix } } From b2ee9608996b86dc4468c988c4f5fb43349ad3a3 Mon Sep 17 00:00:00 2001 From: aidenvaines-bjss Date: Mon, 5 Aug 2024 11:18:31 +0100 Subject: [PATCH 2/4] CCM-5680 Support dedicated dev env branches --- .../terraform/components/branch/module_amplify_branch.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/terraform/components/branch/module_amplify_branch.tf b/infrastructure/terraform/components/branch/module_amplify_branch.tf index 2737e90..8a1b83d 100644 --- a/infrastructure/terraform/components/branch/module_amplify_branch.tf +++ b/infrastructure/terraform/components/branch/module_amplify_branch.tf @@ -13,6 +13,6 @@ module "amplify_branch" { cognito_user_pool_identity_provider_names = local.iam.cognito_user_pool["identity_providers"] amplify_app_id = local.iam.amplify["id"] branch = var.branch_name - domain_name = local.iam.amplify["domain_name"] + domain_name = local.dns_prefix subdomain = var.environment } From 8b640870fbee76590672fe5e4a6c84520f40171e Mon Sep 17 00:00:00 2001 From: aidenvaines-bjss Date: Mon, 5 Aug 2024 11:21:54 +0100 Subject: [PATCH 3/4] CCM-5680 Support dedicated dev env branches --- infrastructure/terraform/components/branch/locals.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/terraform/components/branch/locals.tf b/infrastructure/terraform/components/branch/locals.tf index 0b78a0a..b5fa7f1 100644 --- a/infrastructure/terraform/components/branch/locals.tf +++ b/infrastructure/terraform/components/branch/locals.tf @@ -1,3 +1,3 @@ locals { - dns_prefix = "${var.environment}.${local.acct.dns_zone["name"]}" + dns_prefix = "${var.environment}.${local.iam.amplify["domain_name"]}" } From 3a114190f30e900bd2ddd55927a71469729a76e3 Mon Sep 17 00:00:00 2001 From: aidenvaines-bjss Date: Mon, 5 Aug 2024 11:23:43 +0100 Subject: [PATCH 4/4] CCM-5680 tf lint --- infrastructure/terraform/components/iam/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/terraform/components/iam/outputs.tf b/infrastructure/terraform/components/iam/outputs.tf index 3b39607..b3a51dd 100644 --- a/infrastructure/terraform/components/iam/outputs.tf +++ b/infrastructure/terraform/components/iam/outputs.tf @@ -13,7 +13,7 @@ output "cognito_user_pool_client" { output "amplify" { value = { - id = aws_amplify_app.main.id + id = aws_amplify_app.main.id domain_name = local.dns_prefix } }