Skip to content

Commit

Permalink
Merge pull request #52 from NHSDigital/aiva2/CCM-6603_refactorAmplify…
Browse files Browse the repository at this point in the history
…Component

CCM-6603 rename of the amplify component
  • Loading branch information
aidenvaines-bjss authored Sep 16, 2024
2 parents 15ccdca + 57ddac2 commit e38d444
Show file tree
Hide file tree
Showing 27 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr_merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
--arg releaseVersion "main" \
--arg targetEnvironment "main" \
--arg targetAccountGroup "nhs-notify-iam-dev" \
--arg targetComponent "iam" \
--arg targetComponent "app" \
--arg terraformAction "apply" \
'{ "ref": "main",
"inputs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ variable "group" {
variable "component" {
type = string
description = "The variable encapsulating the name of this component"
default = "iam"
default = "app"
}

variable "default_tags" {
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/terraform/components/branch/locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
locals {
root_domain_name = "${var.environment}.${local.iam.amplify["domain_name"]}"
root_domain_name = "${var.environment}.${local.app.amplify["domain_name"]}"
normalised_branch_name = lower(substr(join("", regexall("[a-zA-Z0-9-]+", var.branch_name)), 0, 25))
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
bootstrap = data.terraform_remote_state.bootstrap.outputs
iam = data.terraform_remote_state.iam.outputs
app = data.terraform_remote_state.app.outputs
}

data "terraform_remote_state" "bootstrap" {
Expand All @@ -21,14 +21,14 @@ data "terraform_remote_state" "bootstrap" {
}
}

data "terraform_remote_state" "iam" {
data "terraform_remote_state" "app" {
backend = "s3"

config = {
bucket = local.terraform_state_bucket

key = format(
"%s/%s/%s/%s/iam.tfstate",
"%s/%s/%s/%s/app.tfstate",
var.project,
var.aws_account_id,
"eu-west-2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ module "amplify_branch" {
region = var.region
group = var.group

amplify_app_id = local.iam.amplify["id"]
amplify_app_id = local.app.amplify["id"]
branch = var.branch_name
enable_auto_build = true

environment_variables = {
USER_POOL_CLIENT_ID = local.iam.cognito_user_pool_client["id"]
USER_POOL_CLIENT_ID = local.app.cognito_user_pool_client["id"]
NOTIFY_SUBDOMAIN = var.environment
NEXT_PUBLIC_BASE_PATH = "/auth~${local.normalised_branch_name}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "null_resource" "remove_amplify_branch" {
# Despite destroying the resource, apparently Amplify thinks we want to keep the branch resrouce around
triggers = {
csi = local.csi
amplify_app_id = local.iam.amplify["id"]
amplify_app_id = local.app.amplify["id"]
amplify_branch_name = module.amplify_branch.name
}

Expand Down

0 comments on commit e38d444

Please sign in to comment.