From de7bd59d7f285f4f86e8f8250f43461dd8a26124 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 15 Nov 2023 08:51:31 -0800 Subject: [PATCH 01/19] github action for terraform plan test --- .github/workflows/terraform-plan.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/terraform-plan.yml diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml new file mode 100644 index 0000000..a585e9f --- /dev/null +++ b/.github/workflows/terraform-plan.yml @@ -0,0 +1,28 @@ +name: PR Terraform Plan + +on: [pull_request] + +permissions: + contents: read + pull-requests: write + +jobs: + plan: + runs-on: ubuntu-latest + name: Create terraform plan + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION_PROD }} + - name: Checkout + uses: actions/checkout@v3 + + - name: terraform plan + uses: dflook/terraform-plan@v1 + with: + path: terraform-incubator/vrms-client/dev \ No newline at end of file From 9316ee580112442dc30016687dd2fea2bf5c93a3 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 15 Nov 2023 08:56:42 -0800 Subject: [PATCH 02/19] move aws creds to env --- .github/workflows/terraform-plan.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index a585e9f..7ea83e2 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -11,14 +11,10 @@ jobs: runs-on: ubuntu-latest name: Create terraform plan env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} + AWS_SECRET_ACCESS_KEY: ${{secrets.INCUBATOR_AWS_SECRET_ACCESS_KEY}} steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION_PROD }} - name: Checkout uses: actions/checkout@v3 From 8bba9fc632416de00ac4d997bfcba383115092e7 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 15 Nov 2023 08:58:26 -0800 Subject: [PATCH 03/19] switch to people-depot for testing --- .github/workflows/terraform-plan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 7ea83e2..cd1f06d 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -21,4 +21,4 @@ jobs: - name: terraform plan uses: dflook/terraform-plan@v1 with: - path: terraform-incubator/vrms-client/dev \ No newline at end of file + path: terraform-incubator/people-depot/dev \ No newline at end of file From 06b8e6f58204beadd4568f32149e6c700820ee09 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:19:51 -0800 Subject: [PATCH 04/19] add files changed --- .github/workflows/terraform-plan.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index cd1f06d..045654d 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -7,6 +7,29 @@ permissions: pull-requests: write jobs: + changed-files: + name: Get changed files + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.changed-files.outputs.all_changed_files }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get changed files + id: changed-files + uses: j-actions/changed-files@v40 + with: + files: | + 'terraform-incubator/**.tf' + json: true + quotepath: false + escape_json: false + - name: List all changed files + run: echo '${{ steps.changed-files.outputs.all_changed_files }}' + + plan: runs-on: ubuntu-latest name: Create terraform plan @@ -17,7 +40,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: terraform plan uses: dflook/terraform-plan@v1 with: From fdd5f92505917efb20f79fa4bfa53bf4eb1c0dde Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:25:02 -0800 Subject: [PATCH 05/19] fixing action ref --- .github/workflows/terraform-plan.yml | 5 ++--- terraform-incubator/people-depot/project/main.tf | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 045654d..2bdd48b 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -19,7 +19,7 @@ jobs: fetch-depth: 0 - name: Get changed files id: changed-files - uses: j-actions/changed-files@v40 + uses: tj-actions/changed-files@v40 with: files: | 'terraform-incubator/**.tf' @@ -28,11 +28,10 @@ jobs: escape_json: false - name: List all changed files run: echo '${{ steps.changed-files.outputs.all_changed_files }}' - - plan: runs-on: ubuntu-latest name: Create terraform plan + needs: [changed-files] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} diff --git a/terraform-incubator/people-depot/project/main.tf b/terraform-incubator/people-depot/project/main.tf index 561f4ac..01b754d 100644 --- a/terraform-incubator/people-depot/project/main.tf +++ b/terraform-incubator/people-depot/project/main.tf @@ -22,7 +22,7 @@ module "people_depot" { COGNITO_AWS_REGION = "us-west-2" DATABASE = "postgres" DJANGO_ALLOWED_HOSTS = "localhost 127.0.0.1 [::1]" - SECRET_KEY = "foo" + SECRET_KEY = "bar" SQL_DATABASE = "people_depot_dev" SQL_ENGINE = "django.db.backends.postgresql" SQL_PASSWORD = var.app_db_password From 5620defb038112dd7e750209c28488dbd6832a6e Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:27:33 -0800 Subject: [PATCH 06/19] fix file pattern --- .github/workflows/terraform-plan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 2bdd48b..17a82dc 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -22,7 +22,7 @@ jobs: uses: tj-actions/changed-files@v40 with: files: | - 'terraform-incubator/**.tf' + **.md json: true quotepath: false escape_json: false From c7ca9c7e3597df119b32a932b7420751c807c7e1 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:29:06 -0800 Subject: [PATCH 07/19] fix file pattern --- .github/workflows/terraform-plan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 17a82dc..d775996 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -22,7 +22,7 @@ jobs: uses: tj-actions/changed-files@v40 with: files: | - **.md + **.tf json: true quotepath: false escape_json: false From 3e30854aae81c838563d276ff08d7660014a3ae4 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:07:12 -0800 Subject: [PATCH 08/19] add file change logic --- .github/workflows/terraform-plan.yml | 63 +++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index d775996..21be7a3 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -8,10 +8,12 @@ permissions: jobs: changed-files: - name: Get changed files + name: Get changed terraform directories runs-on: ubuntu-latest outputs: - matrix: ${{ steps.changed-files.outputs.all_changed_files }} + module-change: ${{ steps.changed-files.outputs.module-change }} + project-change: ${{ steps.changed-files.outputs.project-change }} + environment-change: ${{ steps.changed-files.outputs.environment-change }} steps: - name: Checkout uses: actions/checkout@v4 @@ -19,19 +21,23 @@ jobs: fetch-depth: 0 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v40 + uses: dorny/paths-filter@v2 with: - files: | - **.tf - json: true - quotepath: false - escape_json: false + filters: | + module-change: + - 'terraform-modules/**' + project-change: + - 'terraform-incubator/**/project/**' + environment-change: + - 'terraform-incubator/**' + list-files: json - name: List all changed files - run: echo '${{ steps.changed-files.outputs.all_changed_files }}' - plan: + run: echo '${{ steps.changed-files.outputs }}' + plan-all: runs-on: ubuntu-latest name: Create terraform plan needs: [changed-files] + if: ${{ needs.changed-files.outputs.module-change == 'true' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} @@ -39,7 +45,42 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + + - name: terraform plan + uses: dflook/terraform-plan@v1 + with: + path: terraform-incubator/people-depot/dev + plan-project: + runs-on: ubuntu-latest + name: Create terraform plan + needs: [changed-files] + if: ${{ needs.changed-files.outputs.project-change == 'true' }} & ${{ needs.changed-files.outputs.module-change == 'false' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} + AWS_SECRET_ACCESS_KEY: ${{secrets.INCUBATOR_AWS_SECRET_ACCESS_KEY}} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: terraform plan + uses: dflook/terraform-plan@v1 + with: + path: terraform-incubator/people-depot/dev + plan-environment: + runs-on: ubuntu-latest + name: Create terraform plan + needs: [changed-files] + if: ${{ needs.changed-files.outputs.environment-change == 'true' }} & ${{ needs.changed-files.outputs.module-change == 'false' }} & ${{ needs.changed-files.outputs.project-change == 'false' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} + AWS_SECRET_ACCESS_KEY: ${{secrets.INCUBATOR_AWS_SECRET_ACCESS_KEY}} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: terraform plan uses: dflook/terraform-plan@v1 with: - path: terraform-incubator/people-depot/dev \ No newline at end of file + path: terraform-incubator/people-depot/dev \ No newline at end of file From 7efc6c0f9413a376e030180f2b4b380ec028ae00 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:11:15 -0800 Subject: [PATCH 09/19] print changed files --- .github/workflows/terraform-plan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 21be7a3..1b970f0 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -32,7 +32,7 @@ jobs: - 'terraform-incubator/**' list-files: json - name: List all changed files - run: echo '${{ steps.changed-files.outputs }}' + run: echo '${{ steps.changed-files.outputs.changes }}' plan-all: runs-on: ubuntu-latest name: Create terraform plan From 63a2c3c6072e01d7338305b9f5e34391b41e97da Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:21:01 -0800 Subject: [PATCH 10/19] print files --- .github/workflows/terraform-plan.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 1b970f0..53b8287 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -32,12 +32,15 @@ jobs: - 'terraform-incubator/**' list-files: json - name: List all changed files - run: echo '${{ steps.changed-files.outputs.changes }}' + run: echo '${{ steps.changed-files.outputs.project-change_files }}' plan-all: runs-on: ubuntu-latest name: Create terraform plan needs: [changed-files] if: ${{ needs.changed-files.outputs.module-change == 'true' }} + strategy: + matrix: + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} From d88c385051697e99bbeeea2a8cffd53626b4f7fe Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:28:41 -0800 Subject: [PATCH 11/19] comment out for test --- .github/workflows/terraform-plan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 53b8287..7de2583 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -38,9 +38,9 @@ jobs: name: Create terraform plan needs: [changed-files] if: ${{ needs.changed-files.outputs.module-change == 'true' }} - strategy: - matrix: - + # strategy: + # matrix: + # directories: ${{ fromJSON(needs.changed-files.outputs.module-change_files) }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} From e9a39d7c4244aa760256e5919a02cfc03b0e9988 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:53:17 -0800 Subject: [PATCH 12/19] add extra filtering to capture just env changes --- .github/workflows/terraform-plan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 7de2583..fed27b0 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -27,9 +27,9 @@ jobs: module-change: - 'terraform-modules/**' project-change: - - 'terraform-incubator/**/project/**' + - 'terraform-incubator/*/project/*' environment-change: - - 'terraform-incubator/**' + - 'terraform-incubator/*/!(project)' list-files: json - name: List all changed files run: echo '${{ steps.changed-files.outputs.project-change_files }}' @@ -40,7 +40,7 @@ jobs: if: ${{ needs.changed-files.outputs.module-change == 'true' }} # strategy: # matrix: - # directories: ${{ fromJSON(needs.changed-files.outputs.module-change_files) }} + # directories: ${{ }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} From 5ffde1a4c9cee4c89ebb69f9f9e192153227d9a6 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:56:23 -0800 Subject: [PATCH 13/19] change env --- .github/workflows/terraform-plan.yml | 4 ++-- terraform-incubator/people-depot/dev/main.tf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index fed27b0..c3f953d 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -27,9 +27,9 @@ jobs: module-change: - 'terraform-modules/**' project-change: - - 'terraform-incubator/*/project/*' + - 'terraform-incubator/*/project/*.tf' environment-change: - - 'terraform-incubator/*/!(project)' + - 'terraform-incubator/*/!(project)/*.tf' list-files: json - name: List all changed files run: echo '${{ steps.changed-files.outputs.project-change_files }}' diff --git a/terraform-incubator/people-depot/dev/main.tf b/terraform-incubator/people-depot/dev/main.tf index 65f8812..e3cd3ab 100644 --- a/terraform-incubator/people-depot/dev/main.tf +++ b/terraform-incubator/people-depot/dev/main.tf @@ -26,7 +26,7 @@ module "dev" { root_db_password = var.root_db_password app_db_password = var.app_db_password - container_image = "035866691871.dkr.ecr.us-west-2.amazonaws.com/people-depot-backend-dev:latest" + container_image = "035866691871.dkr.ecr.us-west-2.amazonaws.com/people-depot-backend-dev:new" } moved { From cfc9a146b84787a245e870427d9f211e068e6783 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:04:59 -0800 Subject: [PATCH 14/19] adding matrix for plan on module change --- .github/workflows/terraform-plan.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index c3f953d..34709b5 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -32,15 +32,15 @@ jobs: - 'terraform-incubator/*/!(project)/*.tf' list-files: json - name: List all changed files - run: echo '${{ steps.changed-files.outputs.project-change_files }}' + run: echo '${{ steps.changed-files.outputs.module-change_files }}'; echo '${{ steps.changed-files.outputs.project-change_files }}'; echo '${{ steps.changed-files.outputs.environment-change_files }}' plan-all: runs-on: ubuntu-latest name: Create terraform plan needs: [changed-files] if: ${{ needs.changed-files.outputs.module-change == 'true' }} - # strategy: - # matrix: - # directories: ${{ }} + strategy: + matrix: + directory: ${{ needs.changed-files.outputs.environment-change }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} @@ -52,7 +52,7 @@ jobs: - name: terraform plan uses: dflook/terraform-plan@v1 with: - path: terraform-incubator/people-depot/dev + path: ${{ matrix.directory }} plan-project: runs-on: ubuntu-latest name: Create terraform plan From 1f1a56b42b9ac7d8e9dbb5f6a40d8a0c5ed7afa8 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Sat, 20 Jan 2024 15:12:57 -0800 Subject: [PATCH 15/19] add defaults to variable for testing purposes --- terraform-incubator/people-depot/dev/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terraform-incubator/people-depot/dev/main.tf b/terraform-incubator/people-depot/dev/main.tf index e3cd3ab..5142c71 100644 --- a/terraform-incubator/people-depot/dev/main.tf +++ b/terraform-incubator/people-depot/dev/main.tf @@ -15,10 +15,12 @@ provider "aws" { variable "root_db_password" { type = string description = "root database password" + default = "password" } variable "app_db_password" { type = string + default = "password" } module "dev" { From 69c4438bb455f8e00bc1ff4ed997a6c7a2213930 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:34:13 -0800 Subject: [PATCH 16/19] change names so easier to see --- .github/workflows/terraform-plan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 34709b5..d122b80 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -35,7 +35,7 @@ jobs: run: echo '${{ steps.changed-files.outputs.module-change_files }}'; echo '${{ steps.changed-files.outputs.project-change_files }}'; echo '${{ steps.changed-files.outputs.environment-change_files }}' plan-all: runs-on: ubuntu-latest - name: Create terraform plan + name: Terraform plan - all directories needs: [changed-files] if: ${{ needs.changed-files.outputs.module-change == 'true' }} strategy: @@ -55,7 +55,7 @@ jobs: path: ${{ matrix.directory }} plan-project: runs-on: ubuntu-latest - name: Create terraform plan + name: CTerraform plan - Project changes needs: [changed-files] if: ${{ needs.changed-files.outputs.project-change == 'true' }} & ${{ needs.changed-files.outputs.module-change == 'false' }} env: @@ -72,7 +72,7 @@ jobs: path: terraform-incubator/people-depot/dev plan-environment: runs-on: ubuntu-latest - name: Create terraform plan + name: Terraform plan - Env changes needs: [changed-files] if: ${{ needs.changed-files.outputs.environment-change == 'true' }} & ${{ needs.changed-files.outputs.module-change == 'false' }} & ${{ needs.changed-files.outputs.project-change == 'false' }} env: From 92a3c9b47dacf164963821d0b996ab5bd6d5e437 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:37:21 -0800 Subject: [PATCH 17/19] fixing if statements --- .github/workflows/terraform-plan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index d122b80..63f26f7 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -55,9 +55,9 @@ jobs: path: ${{ matrix.directory }} plan-project: runs-on: ubuntu-latest - name: CTerraform plan - Project changes + name: Terraform plan - Project changes needs: [changed-files] - if: ${{ needs.changed-files.outputs.project-change == 'true' }} & ${{ needs.changed-files.outputs.module-change == 'false' }} + if: (${{ needs.changed-files.outputs.project-change == 'true' }} && ${{ needs.changed-files.outputs.module-change == 'false' }}) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} @@ -74,7 +74,7 @@ jobs: runs-on: ubuntu-latest name: Terraform plan - Env changes needs: [changed-files] - if: ${{ needs.changed-files.outputs.environment-change == 'true' }} & ${{ needs.changed-files.outputs.module-change == 'false' }} & ${{ needs.changed-files.outputs.project-change == 'false' }} + if: (${{ needs.changed-files.outputs.environment-change == 'true' }} && ${{ needs.changed-files.outputs.module-change == 'false' }} && ${{ needs.changed-files.outputs.project-change == 'false' }}) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} From 9a91d202aee1efd469a34572ba0da0b004ea55e3 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:44:34 -0800 Subject: [PATCH 18/19] fix conditional --- .github/workflows/terraform-plan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 63f26f7..d6f0b96 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -57,7 +57,7 @@ jobs: runs-on: ubuntu-latest name: Terraform plan - Project changes needs: [changed-files] - if: (${{ needs.changed-files.outputs.project-change == 'true' }} && ${{ needs.changed-files.outputs.module-change == 'false' }}) + if: ${{ needs.changed-files.outputs.project-change == 'true' && needs.changed-files.outputs.module-change == 'false'}} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} @@ -74,7 +74,7 @@ jobs: runs-on: ubuntu-latest name: Terraform plan - Env changes needs: [changed-files] - if: (${{ needs.changed-files.outputs.environment-change == 'true' }} && ${{ needs.changed-files.outputs.module-change == 'false' }} && ${{ needs.changed-files.outputs.project-change == 'false' }}) + if: ${{ needs.changed-files.outputs.environment-change == 'true' && needs.changed-files.outputs.module-change == 'false' && needs.changed-files.outputs.project-change == 'false' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}} From 8c19dcf6a758eacad266679c2a2446a36ebe6771 Mon Sep 17 00:00:00 2001 From: Tyson Miller <56799434+Tyson-miller@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:01:35 -0800 Subject: [PATCH 19/19] removing terraform changes used for testing --- terraform-incubator/people-depot/dev/main.tf | 4 +--- terraform-incubator/people-depot/project/main.tf | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/terraform-incubator/people-depot/dev/main.tf b/terraform-incubator/people-depot/dev/main.tf index 5142c71..65f8812 100644 --- a/terraform-incubator/people-depot/dev/main.tf +++ b/terraform-incubator/people-depot/dev/main.tf @@ -15,12 +15,10 @@ provider "aws" { variable "root_db_password" { type = string description = "root database password" - default = "password" } variable "app_db_password" { type = string - default = "password" } module "dev" { @@ -28,7 +26,7 @@ module "dev" { root_db_password = var.root_db_password app_db_password = var.app_db_password - container_image = "035866691871.dkr.ecr.us-west-2.amazonaws.com/people-depot-backend-dev:new" + container_image = "035866691871.dkr.ecr.us-west-2.amazonaws.com/people-depot-backend-dev:latest" } moved { diff --git a/terraform-incubator/people-depot/project/main.tf b/terraform-incubator/people-depot/project/main.tf index 01b754d..561f4ac 100644 --- a/terraform-incubator/people-depot/project/main.tf +++ b/terraform-incubator/people-depot/project/main.tf @@ -22,7 +22,7 @@ module "people_depot" { COGNITO_AWS_REGION = "us-west-2" DATABASE = "postgres" DJANGO_ALLOWED_HOSTS = "localhost 127.0.0.1 [::1]" - SECRET_KEY = "bar" + SECRET_KEY = "foo" SQL_DATABASE = "people_depot_dev" SQL_ENGINE = "django.db.backends.postgresql" SQL_PASSWORD = var.app_db_password