From 0bc6d661df101d8eb66ab6546f991ff4eea7ee70 Mon Sep 17 00:00:00 2001 From: Gary Crye Date: Wed, 16 Aug 2023 15:05:38 -0600 Subject: [PATCH] Update docs to reflect change, rename `terraform-iac/` to `terraform/` Docs needed to be updated either way. I know we've done some bikeshedding on the directory name before. I didn't previously care whether it was called terraform/, iac/, terraform-iac/ or anything else. Nowadays, I have a tiny reason to prefer the name terraform/: it plays nicely with automatic folder icons. The other options don't. --- .github/dependabot.yml | 4 ++-- .github/workflows/ci-iac.yml | 14 +++++++------- .github/workflows/deploy.yml | 14 +++++++------- README.md | 7 +++---- docker-compose.yml | 2 +- .../app/.terraform.lock.hcl | 0 {terraform-iac => terraform}/app/cpy.s3.tfbackend | 0 {terraform-iac => terraform}/app/cpy.tfvars | 0 {terraform-iac => terraform}/app/dev.s3.tfbackend | 0 {terraform-iac => terraform}/app/dev.tfvars | 0 {terraform-iac => terraform}/app/main.tf | 0 {terraform-iac => terraform}/app/prd.s3.tfbackend | 0 {terraform-iac => terraform}/app/prd.tfvars | 0 {terraform-iac => terraform}/app/stg.s3.tfbackend | 0 {terraform-iac => terraform}/app/stg.tfvars | 0 .../setup/.terraform.lock.hcl | 0 .../setup/cpy.s3.tfbackend | 0 .../setup/dev.s3.tfbackend | 0 .../setup/prd.s3.tfbackend | 0 {terraform-iac => terraform}/setup/setup.tf | 0 .../setup/stg.s3.tfbackend | 0 21 files changed, 20 insertions(+), 21 deletions(-) rename {terraform-iac => terraform}/app/.terraform.lock.hcl (100%) rename {terraform-iac => terraform}/app/cpy.s3.tfbackend (100%) rename {terraform-iac => terraform}/app/cpy.tfvars (100%) rename {terraform-iac => terraform}/app/dev.s3.tfbackend (100%) rename {terraform-iac => terraform}/app/dev.tfvars (100%) rename {terraform-iac => terraform}/app/main.tf (100%) rename {terraform-iac => terraform}/app/prd.s3.tfbackend (100%) rename {terraform-iac => terraform}/app/prd.tfvars (100%) rename {terraform-iac => terraform}/app/stg.s3.tfbackend (100%) rename {terraform-iac => terraform}/app/stg.tfvars (100%) rename {terraform-iac => terraform}/setup/.terraform.lock.hcl (100%) rename {terraform-iac => terraform}/setup/cpy.s3.tfbackend (100%) rename {terraform-iac => terraform}/setup/dev.s3.tfbackend (100%) rename {terraform-iac => terraform}/setup/prd.s3.tfbackend (100%) rename {terraform-iac => terraform}/setup/setup.tf (100%) rename {terraform-iac => terraform}/setup/stg.s3.tfbackend (100%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 72c48281..6d84d25f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -27,13 +27,13 @@ updates: target-branch: dev - package-ecosystem: terraform - directory: '/terraform-iac/app' + directory: '/terraform/app' schedule: interval: daily target-branch: dev - package-ecosystem: terraform - directory: '/terraform-iac/setup' + directory: '/terraform/setup' schedule: interval: daily target-branch: dev diff --git a/.github/workflows/ci-iac.yml b/.github/workflows/ci-iac.yml index 500e864c..4ef0d9be 100644 --- a/.github/workflows/ci-iac.yml +++ b/.github/workflows/ci-iac.yml @@ -5,11 +5,11 @@ on: branches: [dev, stg, prd] types: [opened, reopened, synchronize, edited] paths: - - 'terraform-iac/**' + - 'terraform/**' - '.github/workflows/ci-iac.yml' env: - tf_version: "1.7.0" # must match value in terraform-iac/app/main.tf + tf_version: "1.7.0" # must match value in terraform/app/main.tf jobs: env: @@ -80,7 +80,7 @@ jobs: terraform_version: ${{ env.tf_version }} - name: Terraform Format - working-directory: terraform-iac + working-directory: terraform run: terraform fmt -check -recursive plan: @@ -112,18 +112,18 @@ jobs: terraform_version: ${{ env.tf_version }} - name: Terraform Init - working-directory: terraform-iac/app + working-directory: terraform/app run: terraform init -backend-config=${{ matrix.env.environment_name }}.s3.tfbackend - name: Terraform Plan - working-directory: terraform-iac/app + working-directory: terraform/app run: terraform plan -var-file=${{ matrix.env.environment_name }}.tfvars -var 'image_tag=ci_test' -input=false -out plan -lock=false - name: Comment Terraform Plan uses: byu-oit/github-action-tf-plan-comment@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} - working-directory: terraform-iac/app + working-directory: terraform/app terraform-plan-file: plan - name: Analyze Terraform Plan @@ -131,7 +131,7 @@ jobs: if: github.repository_owner == 'byu-oit' # If you're at BYU, but outside the byu-oit GitHub org, you may be able to obtain credentials by contacting cloudoffice@byu.edu with: - working-directory: terraform-iac/app + working-directory: terraform/app terraform-plan-file: plan divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }} divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a324a1f9..e75b2b1d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ on: - '.gitignore' env: node_version: "18.x" - tf_version: "1.7.0" # must match value in terraform-iac/app/main.tf + tf_version: "1.7.0" # must match value in terraform/app/main.tf FORCE_COLOR: 3 concurrency: ${{ github.ref }} jobs: @@ -183,7 +183,7 @@ jobs: terraform_version: ${{ env.tf_version }} - name: Terraform Format - working-directory: terraform-iac + working-directory: terraform run: terraform fmt -check -recursive build_and_deploy: @@ -242,11 +242,11 @@ jobs: terraform_wrapper: false - name: Terraform Init - working-directory: terraform-iac/app + working-directory: terraform/app run: terraform init -backend-config=${{ matrix.env.environment_name }}.s3.tfbackend - name: Terraform Plan - working-directory: terraform-iac/app + working-directory: terraform/app run: terraform plan -var-file=${{ matrix.env.environment_name }}.tfvars -var 'image_tag=${{ steps.date.outputs.timestamp }}' -input=false -out=plan - name: Analyze Terraform Plan @@ -254,7 +254,7 @@ jobs: if: github.repository_owner == 'byu-oit' # If you're at BYU, but outside the byu-oit GitHub org, you may be able to obtain credentials by contacting cloudoffice@byu.edu with: - working-directory: terraform-iac/app + working-directory: terraform/app terraform-plan-file: plan divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }} divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }} @@ -268,12 +268,12 @@ jobs: template-id: ${{ matrix.env.rfc_template_id }} - name: Terraform Apply - working-directory: terraform-iac/app + working-directory: terraform/app run: terraform apply plan - name: Get Terraform Outputs id: terraform-outputs - working-directory: terraform-iac/app + working-directory: terraform/app run: | echo "codedeploy_app_name=$(terraform output -raw codedeploy_app_name)" >> $GITHUB_OUTPUT echo "codedeploy_deployment_group_name=$(terraform output -raw codedeploy_deployment_group_name)" >> $GITHUB_OUTPUT diff --git a/README.md b/README.md index 459be881..43caf715 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ git commit -am "Update template with repo specific details" ### Deploy the "one time setup" resources ```sh -cd terraform-iac/dev/setup/ -terraform init -terraform apply +cd terraform/setup/ +terraform init -backend-config=dev.s3.tfbackend +terraform apply -var-file=dev.tfvars ``` In the AWS Console, see if you can find the resources from `setup.tf` (ECR, SSM Param, IAM Role). @@ -72,7 +72,6 @@ If you look at [`.github/workflows/deploy.yml`](.github/workflows/deploy.yml), y Anytime after the `Terraform Apply` step succeeds: ```sh cd ../app/ -terraform init terraform output ``` diff --git a/docker-compose.yml b/docker-compose.yml index 837e571a..36209e37 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: volumes: - ~/.aws:/home/node/.aws # Use AWS credentials from host environment: - # Environment variables and secrets from primary_container_definition in terraform-iac/modules/app/main.tf + # Environment variables and secrets from primary_container_definition in terraform/app/main.tf DYNAMO_TABLE_NAME: hw-fargate-api-dev BUCKET_NAME: hw-fargate-api-dev SOME_SECRET: something diff --git a/terraform-iac/app/.terraform.lock.hcl b/terraform/app/.terraform.lock.hcl similarity index 100% rename from terraform-iac/app/.terraform.lock.hcl rename to terraform/app/.terraform.lock.hcl diff --git a/terraform-iac/app/cpy.s3.tfbackend b/terraform/app/cpy.s3.tfbackend similarity index 100% rename from terraform-iac/app/cpy.s3.tfbackend rename to terraform/app/cpy.s3.tfbackend diff --git a/terraform-iac/app/cpy.tfvars b/terraform/app/cpy.tfvars similarity index 100% rename from terraform-iac/app/cpy.tfvars rename to terraform/app/cpy.tfvars diff --git a/terraform-iac/app/dev.s3.tfbackend b/terraform/app/dev.s3.tfbackend similarity index 100% rename from terraform-iac/app/dev.s3.tfbackend rename to terraform/app/dev.s3.tfbackend diff --git a/terraform-iac/app/dev.tfvars b/terraform/app/dev.tfvars similarity index 100% rename from terraform-iac/app/dev.tfvars rename to terraform/app/dev.tfvars diff --git a/terraform-iac/app/main.tf b/terraform/app/main.tf similarity index 100% rename from terraform-iac/app/main.tf rename to terraform/app/main.tf diff --git a/terraform-iac/app/prd.s3.tfbackend b/terraform/app/prd.s3.tfbackend similarity index 100% rename from terraform-iac/app/prd.s3.tfbackend rename to terraform/app/prd.s3.tfbackend diff --git a/terraform-iac/app/prd.tfvars b/terraform/app/prd.tfvars similarity index 100% rename from terraform-iac/app/prd.tfvars rename to terraform/app/prd.tfvars diff --git a/terraform-iac/app/stg.s3.tfbackend b/terraform/app/stg.s3.tfbackend similarity index 100% rename from terraform-iac/app/stg.s3.tfbackend rename to terraform/app/stg.s3.tfbackend diff --git a/terraform-iac/app/stg.tfvars b/terraform/app/stg.tfvars similarity index 100% rename from terraform-iac/app/stg.tfvars rename to terraform/app/stg.tfvars diff --git a/terraform-iac/setup/.terraform.lock.hcl b/terraform/setup/.terraform.lock.hcl similarity index 100% rename from terraform-iac/setup/.terraform.lock.hcl rename to terraform/setup/.terraform.lock.hcl diff --git a/terraform-iac/setup/cpy.s3.tfbackend b/terraform/setup/cpy.s3.tfbackend similarity index 100% rename from terraform-iac/setup/cpy.s3.tfbackend rename to terraform/setup/cpy.s3.tfbackend diff --git a/terraform-iac/setup/dev.s3.tfbackend b/terraform/setup/dev.s3.tfbackend similarity index 100% rename from terraform-iac/setup/dev.s3.tfbackend rename to terraform/setup/dev.s3.tfbackend diff --git a/terraform-iac/setup/prd.s3.tfbackend b/terraform/setup/prd.s3.tfbackend similarity index 100% rename from terraform-iac/setup/prd.s3.tfbackend rename to terraform/setup/prd.s3.tfbackend diff --git a/terraform-iac/setup/setup.tf b/terraform/setup/setup.tf similarity index 100% rename from terraform-iac/setup/setup.tf rename to terraform/setup/setup.tf diff --git a/terraform-iac/setup/stg.s3.tfbackend b/terraform/setup/stg.s3.tfbackend similarity index 100% rename from terraform-iac/setup/stg.s3.tfbackend rename to terraform/setup/stg.s3.tfbackend