From 39b2c457c5d85c53d0890143d27bd0873bce4835 Mon Sep 17 00:00:00 2001 From: Ankur Jain <174601014+ankur-jain-nhs@users.noreply.github.com> Date: Thu, 27 Mar 2025 18:49:37 +0000 Subject: [PATCH 1/7] VIA-102 AJ/AS Deploys successfully --- .../environments/dev/.terraform.lock.hcl | 65 +++++++++++++++++++ infrastructure/environments/dev/locals.tf | 11 ++++ infrastructure/environments/dev/main.tf | 7 ++ infrastructure/environments/dev/provider.tf | 24 +++++++ infrastructure/modules/deploy_app/main.tf | 17 +++++ infrastructure/modules/deploy_app/provider.tf | 28 ++++++++ .../modules/deploy_app/variables.tf | 3 + 7 files changed, 155 insertions(+) create mode 100644 infrastructure/environments/dev/.terraform.lock.hcl create mode 100644 infrastructure/environments/dev/locals.tf create mode 100644 infrastructure/environments/dev/main.tf create mode 100644 infrastructure/environments/dev/provider.tf create mode 100644 infrastructure/modules/deploy_app/main.tf create mode 100644 infrastructure/modules/deploy_app/provider.tf create mode 100644 infrastructure/modules/deploy_app/variables.tf diff --git a/infrastructure/environments/dev/.terraform.lock.hcl b/infrastructure/environments/dev/.terraform.lock.hcl new file mode 100644 index 00000000..0fe72dc4 --- /dev/null +++ b/infrastructure/environments/dev/.terraform.lock.hcl @@ -0,0 +1,65 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/archive" { + version = "2.7.0" + constraints = ">= 2.3.0" + hashes = [ + "h1:uZO0XsK1RW1mBRn8SsVPXT76pSSbyb4SmA0eLJsOe38=", + "zh:04e23bebca7f665a19a032343aeecd230028a3822e546e6f618f24c47ff87f67", + "zh:5bb38114238e25c45bf85f5c9f627a2d0c4b98fe44a0837e37d48574385f8dad", + "zh:64584bc1db4c390abd81c76de438d93acf967c8a33e9b923d68da6ed749d55bd", + "zh:697695ab9cce351adf91a1823bdd72ce6f0d219138f5124ef7645cedf8f59a1f", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:7edefb1d1e2fead8fd155f7b50a2cb49f2f3fed154ac3ef5f991ccaff93d6120", + "zh:807fb15b75910bf14795f2ad1a2d41b069f9ef52c242131b2964c8527312e235", + "zh:821d9148d261df1d1a8e5a4812df2a6a3ffaf0d2070dad3c785382e489069239", + "zh:a7d92251118fb723048c482154a6ac6368aad583d28d15fffc6f5dafd9507463", + "zh:b627d4cef192b3c12ddaf9cb2c4f98c10d0129883c8c2a9c0049983f9de7030d", + "zh:dfb70306fcc0ad1d512ab7c24765703783cc286062d4849de4fbe23526f5dc8e", + "zh:f21de276f857b7e51fa2593d8fef05a7faafb0a7b62db14ac58a03ce1be7d881", + ] +} + +provider "registry.terraform.io/hashicorp/aws" { + version = "5.92.0" + constraints = ">= 5.26.0, >= 5.46.0, >= 5.92.0" + hashes = [ + "h1:c8EuoHPbh+vmRudijhbF5h8H/FBH+CsnMbrW9LaGXRM=", + "zh:1d3a0b40831360e8e988aee74a9ff3d69d95cb541c2eae5cb843c64303a091ba", + "zh:3d29cbced6c708be2041a708d25c7c0fc22d09e4d0b174360ed113bfae786137", + "zh:4341a203cf5820a0ca18bb514ae10a6c113bc6a728fb432acbf817d232e8eff4", + "zh:4a49e2d91e4d92b6b93ccbcbdcfa2d67935ce62e33b939656766bb81b3fd9a2c", + "zh:54c7189358b37fd895dedbabf84e509c1980a8c404a1ee5b29b06e40497b8655", + "zh:5d8bb1ff089c37cb65c83b4647f1981fded993e87d8132915d92d79f29e2fcd8", + "zh:618f2eb87cd65b245aefba03991ad714a51ff3b841016ef68e2da2b85d0b2325", + "zh:7bce07bc542d0588ca42bac5098dd4f8af715417cd30166b4fb97cedd44ab109", + "zh:81419eab2d8810beb114b1ff5cbb592d21edc21b809dc12bb066e4b88fdd184a", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:9dea39d4748eeeebe2e76ca59bca4ccd161c2687050878c47289a98407a23372", + "zh:d692fc33b67ac89e916c8f9233d39eacab8c438fe10172990ee9d94fba5ca372", + "zh:d9075c7da48947c029ba47d5985e1e8e3bf92367bfee8ca1ff0e747765e779a1", + "zh:e81c62db317f3b640b2e04eba0ada8aa606bcbae0152c09f6242e86b86ef5889", + "zh:f68562e073722c378d2f3529eb80ad463f12c44aa5523d558ae3b69f4de5ca1f", + ] +} + +provider "registry.terraform.io/hashicorp/local" { + version = "2.5.2" + constraints = ">= 2.4.0" + hashes = [ + "h1:p99F1AoV9z51aJ4EdItxz/vLwWIyhx/0Iw7L7sWSH1o=", + "zh:136299545178ce281c56f36965bf91c35407c11897f7082b3b983d86cb79b511", + "zh:3b4486858aa9cb8163378722b642c57c529b6c64bfbfc9461d940a84cd66ebea", + "zh:4855ee628ead847741aa4f4fc9bed50cfdbf197f2912775dd9fe7bc43fa077c0", + "zh:4b8cd2583d1edcac4011caafe8afb7a95e8110a607a1d5fb87d921178074a69b", + "zh:52084ddaff8c8cd3f9e7bcb7ce4dc1eab00602912c96da43c29b4762dc376038", + "zh:71562d330d3f92d79b2952ffdda0dad167e952e46200c767dd30c6af8d7c0ed3", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:805f81ade06ff68fa8b908d31892eaed5c180ae031c77ad35f82cb7a74b97cf4", + "zh:8b6b3ebeaaa8e38dd04e56996abe80db9be6f4c1df75ac3cccc77642899bd464", + "zh:ad07750576b99248037b897de71113cc19b1a8d0bc235eb99173cc83d0de3b1b", + "zh:b9f1c3bfadb74068f5c205292badb0661e17ac05eb23bfe8bd809691e4583d0e", + "zh:cc4cbcd67414fefb111c1bf7ab0bc4beb8c0b553d01719ad17de9a047adff4d1", + ] +} diff --git a/infrastructure/environments/dev/locals.tf b/infrastructure/environments/dev/locals.tf new file mode 100644 index 00000000..cba3d452 --- /dev/null +++ b/infrastructure/environments/dev/locals.tf @@ -0,0 +1,11 @@ +locals { + region = "eu-west-2" + project_identifier = "vaccinations-app" + project_identifier_shortcode = "vita" + environment = "dev" + default_tags = { + ManagedBy = "Terraform" + Project = local.project_identifier + Environment = local.environment + } +} diff --git a/infrastructure/environments/dev/main.tf b/infrastructure/environments/dev/main.tf new file mode 100644 index 00000000..a3cb35bf --- /dev/null +++ b/infrastructure/environments/dev/main.tf @@ -0,0 +1,7 @@ +module "deploy" { + source = "../../modules/deploy_app" + + open-next-path = "../../../.open-next" + prefix = local.project_identifier_shortcode + default_tags = local.default_tags +} diff --git a/infrastructure/environments/dev/provider.tf b/infrastructure/environments/dev/provider.tf new file mode 100644 index 00000000..53b1faf2 --- /dev/null +++ b/infrastructure/environments/dev/provider.tf @@ -0,0 +1,24 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 5.92.0" + } + } + + backend "s3" { + bucket = "vaccinations-app-tfstate" + key = "terraform.tfstate" + region = "eu-west-2" + + use_lockfile = true + encrypt = true + } +} + +provider "aws" { + region = local.region + default_tags { + tags = local.default_tags + } +} diff --git a/infrastructure/modules/deploy_app/main.tf b/infrastructure/modules/deploy_app/main.tf new file mode 100644 index 00000000..05524602 --- /dev/null +++ b/infrastructure/modules/deploy_app/main.tf @@ -0,0 +1,17 @@ +data "aws_caller_identity" "current" {} + +module "deploy_app" { + source = "RJPearson94/open-next/aws//modules/tf-aws-open-next-zone" + version = ">= 3.4.0,< 3.5.0" + open_next_version = "v3.5.3" + + providers = { + aws.server_function = aws.server_function + aws.iam = aws.iam + aws.dns = aws.dns + aws.global = aws.global + } + + prefix = "${var.prefix}-${data.aws_caller_identity.current.account_id}" + folder_path = var.open-next-path +} diff --git a/infrastructure/modules/deploy_app/provider.tf b/infrastructure/modules/deploy_app/provider.tf new file mode 100644 index 00000000..dbfda25d --- /dev/null +++ b/infrastructure/modules/deploy_app/provider.tf @@ -0,0 +1,28 @@ +provider "aws" { + alias = "server_function" + default_tags { + tags = var.default_tags + } +} + +provider "aws" { + alias = "iam" + default_tags { + tags = var.default_tags + } +} + +provider "aws" { + alias = "dns" + default_tags { + tags = var.default_tags + } +} + +provider "aws" { + alias = "global" + region = "us-east-1" + default_tags { + tags = var.default_tags + } +} diff --git a/infrastructure/modules/deploy_app/variables.tf b/infrastructure/modules/deploy_app/variables.tf new file mode 100644 index 00000000..c34b2444 --- /dev/null +++ b/infrastructure/modules/deploy_app/variables.tf @@ -0,0 +1,3 @@ +variable "prefix" {} +variable "open-next-path" {} +variable "default_tags" {} From 81923c3f0f7a3af7f4bf60c3593e6e8e77eebe76 Mon Sep 17 00:00:00 2001 From: Ankur Jain <174601014+ankur-jain-nhs@users.noreply.github.com> Date: Fri, 28 Mar 2025 09:48:42 +0000 Subject: [PATCH 2/7] VIA-102 AJ/AS Refactoring to look prettier --- infrastructure/modules/deploy_app/data.tf | 1 + infrastructure/modules/deploy_app/main.tf | 14 ++++++-------- infrastructure/modules/deploy_app/variables.tf | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 infrastructure/modules/deploy_app/data.tf diff --git a/infrastructure/modules/deploy_app/data.tf b/infrastructure/modules/deploy_app/data.tf new file mode 100644 index 00000000..8fc4b38c --- /dev/null +++ b/infrastructure/modules/deploy_app/data.tf @@ -0,0 +1 @@ +data "aws_caller_identity" "current" {} diff --git a/infrastructure/modules/deploy_app/main.tf b/infrastructure/modules/deploy_app/main.tf index 05524602..7a2898e0 100644 --- a/infrastructure/modules/deploy_app/main.tf +++ b/infrastructure/modules/deploy_app/main.tf @@ -1,17 +1,15 @@ -data "aws_caller_identity" "current" {} - module "deploy_app" { - source = "RJPearson94/open-next/aws//modules/tf-aws-open-next-zone" - version = ">= 3.4.0,< 3.5.0" + source = "RJPearson94/open-next/aws//modules/tf-aws-open-next-zone" + version = ">= 3.4.0,< 3.5.0" open_next_version = "v3.5.3" providers = { aws.server_function = aws.server_function - aws.iam = aws.iam - aws.dns = aws.dns - aws.global = aws.global + aws.iam = aws.iam + aws.dns = aws.dns + aws.global = aws.global } - prefix = "${var.prefix}-${data.aws_caller_identity.current.account_id}" + prefix = "${var.prefix}-${data.aws_caller_identity.current.account_id}" folder_path = var.open-next-path } diff --git a/infrastructure/modules/deploy_app/variables.tf b/infrastructure/modules/deploy_app/variables.tf index c34b2444..9debf964 100644 --- a/infrastructure/modules/deploy_app/variables.tf +++ b/infrastructure/modules/deploy_app/variables.tf @@ -1,3 +1,14 @@ -variable "prefix" {} -variable "open-next-path" {} -variable "default_tags" {} +variable "prefix" { + type = string + description = "Prefix to be applied to resources created" +} + +variable "open-next-path" { + type = string + description = "Relative path to open next output directory" +} + +variable "default_tags" { + type = string + description = "Map of default key-value pair of tags to add to resources" +} From 46f400edb6d5a385e1809b9c611b3ad81b329176 Mon Sep 17 00:00:00 2001 From: Ankur Jain <174601014+ankur-jain-nhs@users.noreply.github.com> Date: Fri, 28 Mar 2025 10:00:53 +0000 Subject: [PATCH 3/7] VIA-102 AJ/AS README.md files --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fcd991f2..356faa06 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ We will increase appointment attendance and reduce the number of 'did not attend ### GitHub - As per NHS guidelines, make your GitHub email private by going [here](https://github.com/settings/emails). There is a checkbox named "Keep my email addresses private". Note down your private email from this setting. -- Follow these [instructions](https://nhsd-confluence.digital.nhs.uk/display/CSP/How+to+access+GitHub). +- Follow these [instructions](https://nhsd-confluence.digital.nhs.uk/display/Vacc/Developer+setup%3A+Github). - Remember to use your private email, noted above, in GitHub config 'user.email'. - When on the step to create personal access tokens, remember to also tick 'workflow'. This will allow developers to update workflows - Get your NHS GitHub username added to the VitA team to gain access to the repository @@ -88,6 +88,11 @@ From NHS repository template: ``` npx playwright install ``` +- **AWS CLI** - Install aws cli for local deployments. + ``` + brew install awscli + aws configure + ``` ### Local Configuration 1. Create environment variables file .env.local: @@ -147,7 +152,7 @@ npm run test ``` - or with interactive developer UI ``` - npm run e2e + npm run e2e:ui ``` ### Run pre-commit hooks manually From 34e31a0441110f008f824c5167f67c292a339453 Mon Sep 17 00:00:00 2001 From: Ankur Jain <174601014+ankur-jain-nhs@users.noreply.github.com> Date: Fri, 28 Mar 2025 10:13:03 +0000 Subject: [PATCH 4/7] VIA-102 AJ/AS README.md file to configure aws sso --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 356faa06..50e0c211 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ From NHS repository template: - **AWS CLI** - Install aws cli for local deployments. ``` brew install awscli - aws configure + aws configure sso ``` ### Local Configuration From dd29e0c602b3b33f85cdcc5393bf54b14700cb59 Mon Sep 17 00:00:00 2001 From: Ankur Jain <174601014+ankur-jain-nhs@users.noreply.github.com> Date: Fri, 28 Mar 2025 15:07:55 +0000 Subject: [PATCH 5/7] VIA-102 AJ/AS Adding support for distinguishing local vs GitHub naming --- infrastructure/environments/dev/.gitkeep | 0 .../environments/dev/.terraform.lock.hcl | 19 +++++++++++++++++++ infrastructure/environments/dev/data.tf | 7 +++++++ infrastructure/environments/dev/locals.tf | 9 +++++++-- infrastructure/environments/dev/main.tf | 2 +- infrastructure/modules/.gitkeep | 0 .../modules/deploy_app/variables.tf | 2 +- infrastructure/scripts/get_deploy_source.sh | 9 +++++++++ infrastructure/scripts/get_git_branch.sh | 5 +++++ 9 files changed, 49 insertions(+), 4 deletions(-) delete mode 100644 infrastructure/environments/dev/.gitkeep create mode 100644 infrastructure/environments/dev/data.tf delete mode 100644 infrastructure/modules/.gitkeep create mode 100755 infrastructure/scripts/get_deploy_source.sh create mode 100755 infrastructure/scripts/get_git_branch.sh diff --git a/infrastructure/environments/dev/.gitkeep b/infrastructure/environments/dev/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/infrastructure/environments/dev/.terraform.lock.hcl b/infrastructure/environments/dev/.terraform.lock.hcl index 0fe72dc4..78bbd565 100644 --- a/infrastructure/environments/dev/.terraform.lock.hcl +++ b/infrastructure/environments/dev/.terraform.lock.hcl @@ -44,6 +44,25 @@ provider "registry.terraform.io/hashicorp/aws" { ] } +provider "registry.terraform.io/hashicorp/external" { + version = "2.3.4" + hashes = [ + "h1:U6W8rgrdmR2pZ2cicFoGOSQ4GXuIf/4EK7s0vTJN7is=", + "zh:037fd82cd86227359bc010672cd174235e2d337601d4686f526d0f53c87447cb", + "zh:0ea1db63d6173d01f2fa8eb8989f0809a55135a0d8d424b08ba5dabad73095fa", + "zh:17a4d0a306566f2e45778fbac48744b6fd9c958aaa359e79f144c6358cb93af0", + "zh:298e5408ab17fd2e90d2cd6d406c6d02344fe610de5b7dae943a58b958e76691", + "zh:38ecfd29ee0785fd93164812dcbe0664ebbe5417473f3b2658087ca5a0286ecb", + "zh:59f6a6f31acf66f4ea3667a555a70eba5d406c6e6d93c2c641b81d63261eeace", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:ad0279dfd09d713db0c18469f585e58d04748ca72d9ada83883492e0dd13bd58", + "zh:c69f66fd21f5e2c8ecf7ca68d9091c40f19ad913aef21e3ce23836e91b8cbb5f", + "zh:d4a56f8c48aa86fc8e0c233d56850f5783f322d6336f3bf1916e293246b6b5d4", + "zh:f2b394ebd4af33f343835517e80fc876f79361f4688220833bc3c77655dd2202", + "zh:f31982f29f12834e5d21e010856eddd19d59cd8f449adf470655bfd19354377e", + ] +} + provider "registry.terraform.io/hashicorp/local" { version = "2.5.2" constraints = ">= 2.4.0" diff --git a/infrastructure/environments/dev/data.tf b/infrastructure/environments/dev/data.tf new file mode 100644 index 00000000..d051eb5c --- /dev/null +++ b/infrastructure/environments/dev/data.tf @@ -0,0 +1,7 @@ +data "external" "git_branch" { + program = ["bash", "${path.module}/../../scripts/get_git_branch.sh"] +} + +data "external" "deploy_source" { + program = ["bash", "${path.module}/../../scripts/get_deploy_source.sh"] +} diff --git a/infrastructure/environments/dev/locals.tf b/infrastructure/environments/dev/locals.tf index cba3d452..b456b15e 100644 --- a/infrastructure/environments/dev/locals.tf +++ b/infrastructure/environments/dev/locals.tf @@ -1,8 +1,13 @@ locals { - region = "eu-west-2" + region = "eu-west-2" + project_identifier = "vaccinations-app" project_identifier_shortcode = "vita" - environment = "dev" + + environment = "dev" + git_branch = coalesce(data.external.git_branch.result.output, "main") + deploy_source = coalesce(data.external.deploy_source.result.output, "lo") + default_tags = { ManagedBy = "Terraform" Project = local.project_identifier diff --git a/infrastructure/environments/dev/main.tf b/infrastructure/environments/dev/main.tf index a3cb35bf..895b6ea7 100644 --- a/infrastructure/environments/dev/main.tf +++ b/infrastructure/environments/dev/main.tf @@ -2,6 +2,6 @@ module "deploy" { source = "../../modules/deploy_app" open-next-path = "../../../.open-next" - prefix = local.project_identifier_shortcode + prefix = "${local.deploy_source}-${local.git_branch}-${local.project_identifier_shortcode}" default_tags = local.default_tags } diff --git a/infrastructure/modules/.gitkeep b/infrastructure/modules/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/infrastructure/modules/deploy_app/variables.tf b/infrastructure/modules/deploy_app/variables.tf index 9debf964..9700a701 100644 --- a/infrastructure/modules/deploy_app/variables.tf +++ b/infrastructure/modules/deploy_app/variables.tf @@ -9,6 +9,6 @@ variable "open-next-path" { } variable "default_tags" { - type = string + type = map(string) description = "Map of default key-value pair of tags to add to resources" } diff --git a/infrastructure/scripts/get_deploy_source.sh b/infrastructure/scripts/get_deploy_source.sh new file mode 100755 index 00000000..b6b91da7 --- /dev/null +++ b/infrastructure/scripts/get_deploy_source.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ -z "${GITHUB_ACTIONS}" ]]; then + DEPLOY_SOURCE="lo" # local +else + DEPLOY_SOURCE="gh" # github +fi + +echo "{\"output\": \"$DEPLOY_SOURCE\"}" diff --git a/infrastructure/scripts/get_git_branch.sh b/infrastructure/scripts/get_git_branch.sh new file mode 100755 index 00000000..f7102b2e --- /dev/null +++ b/infrastructure/scripts/get_git_branch.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +RAW_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) +BRANCH_NAME=$(echo "$RAW_BRANCH_NAME" | sed 's|/|-|g' | tr '[:upper:]' '[:lower:]') +echo "{\"output\": \"${BRANCH_NAME:0:10}\"}" From 3e9e43198245e38f504d4b060095fa53d2336763 Mon Sep 17 00:00:00 2001 From: Ankur Jain <174601014+ankur-jain-nhs@users.noreply.github.com> Date: Fri, 28 Mar 2025 16:05:26 +0000 Subject: [PATCH 6/7] VIA-102 AJ/AS Adding support for distinguishing workspaces and storing state --- infrastructure/environments/dev/data.tf | 4 ---- infrastructure/environments/dev/locals.tf | 6 +++--- infrastructure/environments/dev/main.tf | 2 +- infrastructure/scripts/get_deploy_source.sh | 9 --------- 4 files changed, 4 insertions(+), 17 deletions(-) delete mode 100755 infrastructure/scripts/get_deploy_source.sh diff --git a/infrastructure/environments/dev/data.tf b/infrastructure/environments/dev/data.tf index d051eb5c..280c99fd 100644 --- a/infrastructure/environments/dev/data.tf +++ b/infrastructure/environments/dev/data.tf @@ -1,7 +1,3 @@ data "external" "git_branch" { program = ["bash", "${path.module}/../../scripts/get_git_branch.sh"] } - -data "external" "deploy_source" { - program = ["bash", "${path.module}/../../scripts/get_deploy_source.sh"] -} diff --git a/infrastructure/environments/dev/locals.tf b/infrastructure/environments/dev/locals.tf index b456b15e..7b0cd54e 100644 --- a/infrastructure/environments/dev/locals.tf +++ b/infrastructure/environments/dev/locals.tf @@ -4,9 +4,9 @@ locals { project_identifier = "vaccinations-app" project_identifier_shortcode = "vita" - environment = "dev" - git_branch = coalesce(data.external.git_branch.result.output, "main") - deploy_source = coalesce(data.external.deploy_source.result.output, "lo") + environment = "dev" + git_branch = coalesce(data.external.git_branch.result.output, "na") + deploy_workspace = terraform.workspace == "default" ? "gh" : terraform.workspace default_tags = { ManagedBy = "Terraform" diff --git a/infrastructure/environments/dev/main.tf b/infrastructure/environments/dev/main.tf index 895b6ea7..759b7806 100644 --- a/infrastructure/environments/dev/main.tf +++ b/infrastructure/environments/dev/main.tf @@ -2,6 +2,6 @@ module "deploy" { source = "../../modules/deploy_app" open-next-path = "../../../.open-next" - prefix = "${local.deploy_source}-${local.git_branch}-${local.project_identifier_shortcode}" + prefix = "${local.deploy_workspace}-${local.git_branch}-${local.project_identifier_shortcode}" default_tags = local.default_tags } diff --git a/infrastructure/scripts/get_deploy_source.sh b/infrastructure/scripts/get_deploy_source.sh deleted file mode 100755 index b6b91da7..00000000 --- a/infrastructure/scripts/get_deploy_source.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [[ -z "${GITHUB_ACTIONS}" ]]; then - DEPLOY_SOURCE="lo" # local -else - DEPLOY_SOURCE="gh" # github -fi - -echo "{\"output\": \"$DEPLOY_SOURCE\"}" From 1f2eb9f2e2751ce6d9c70516b69c712ceb8d3240 Mon Sep 17 00:00:00 2001 From: Anoop Surej <201928812+anoop-surej-nhs@users.noreply.github.com> Date: Fri, 28 Mar 2025 16:38:27 +0000 Subject: [PATCH 7/7] VIA-102 AS Update deploy action with TF steps --- .github/workflows/cicd-3-deploy.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cicd-3-deploy.yaml b/.github/workflows/cicd-3-deploy.yaml index 2745b380..4328e65c 100644 --- a/.github/workflows/cicd-3-deploy.yaml +++ b/.github/workflows/cicd-3-deploy.yaml @@ -57,6 +57,12 @@ jobs: steps: - name: "Checkout code" uses: actions/checkout@v4 + - name: "Deploy" + id: deploy + run: | + TF_ENV=dev make terraform-init + TF_ENV=dev make terraform-plan opts="-out=terraform.tfplan" + TF_ENV=dev make terraform-apply opts="-auto-approve terraform.tfplan" # TODO: More jobs or/and steps here # success: # name: "Success notification"