Skip to content

Commit

Permalink
Update docs to reflect change, rename terraform-iac/ to terraform/
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
GaryGSC committed Jun 24, 2024
1 parent 98ef15b commit 0bc6d66
Show file tree
Hide file tree
Showing 21 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci-iac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -112,26 +112,26 @@ 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
uses: byu-oit/github-action-tf-plan-analyzer@v2
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 [email protected]
with:
working-directory: terraform-iac/app
working-directory: terraform/app
terraform-plan-file: plan
divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }}
divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -242,19 +242,19 @@ 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
uses: byu-oit/github-action-tf-plan-analyzer@v2
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 [email protected]
with:
working-directory: terraform-iac/app
working-directory: terraform/app
terraform-plan-file: plan
divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }}
divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }}
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0bc6d66

Please sign in to comment.