Skip to content

Commit

Permalink
CCM-5680 Support dedicated dev envs
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenvaines-bjss committed Aug 5, 2024
1 parent 0342e4c commit 00ebb63
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.acct.dns_zone["name"]
domain_name = local.dns_prefix
subdomain = var.environment
}
4 changes: 2 additions & 2 deletions infrastructure/terraform/components/iam/amplify_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ resource "aws_amplify_app" "main" {

environment_variables = {
USER_POOL_ID = aws_cognito_user_pool.main.id
# HOSTED_LOGIN_DOMAIN = "auth.${local.acct.dns_zone["name"]}"
# HOSTED_LOGIN_DOMAIN = "auth.${local.dns_prefix}"
NOTIFY_GROUP = var.group
NOTIFY_ENVIRONMENT = var.environment
NOTIFY_DOMAIN_NAME = local.acct.dns_zone["name"]
NOTIFY_DOMAIN_NAME = local.dns_prefix
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# resource "aws_amplify_domain_association" "domain" {
# app_id = aws_amplify_app.main.id
# domain_name = local.acct.dns_zone["name"]
# domain_name = local.dns_prefix
# enable_auto_sub_domain = true

# sub_domain {
Expand All @@ -20,7 +20,7 @@ resource "null_resource" "amplify_domain_association" {
triggers = {
amplify_app_id = aws_amplify_app.main.id
amplify_branch_name = module.amplify_branch.name
amplify_domain_name = local.acct.dns_zone["name"]
amplify_domain_name = local.dns_prefix
}

provisioner "local-exec" {
Expand Down
3 changes: 3 additions & 0 deletions infrastructure/terraform/components/iam/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
dns_prefix = "${var.environment}.${local.acct.dns_zone["name"]}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data "terraform_remote_state" "acct" {
var.project,
var.aws_account_id,
"eu-west-2",
var.environment
var.parent_acct_environment
)

region = "eu-west-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module "amplify_branch" {
cognito_user_pool_identity_provider_names = aws_cognito_user_pool_client.main.supported_identity_providers
amplify_app_id = aws_amplify_app.main.id
branch = "main"
domain_name = local.acct.dns_zone["name"]
domain_name = local.dns_prefix
subdomain = var.environment
enable_auto_deploy = true
}
5 changes: 5 additions & 0 deletions infrastructure/terraform/components/iam/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ variable "root_domain_name" {
default = "nonprod.nhsnotify.national.nhs.uk"
}

variable "parent_acct_environment" {
type = string
description = "Name of the environment responsible for the acct resources used, affects things like DNS zone. Useful for named dev environments"
default = "main"
}
variable "enable_amplify_branch_auto_build" {
type = bool
description = "Enable automatic building of branches"
Expand Down

0 comments on commit 00ebb63

Please sign in to comment.