Skip to content

Commit

Permalink
fix terraform workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
svg153 committed Mar 16, 2024
1 parent 5289690 commit a39d04d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
Expand All @@ -33,17 +33,21 @@ jobs:
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init
working-directory: apps/github-as-code

# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Format
run: terraform fmt -check
working-directory: apps/github-as-code

# Generates an execution plan for Terraform
- name: Terraform Plan
run: terraform plan -input=false
working-directory: apps/github-as-code

# On push to "main", build or change infrastructure according to Terraform configuration files
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks
- name: Terraform Apply
if: github.ref == 'refs/heads/"main"' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false
working-directory: apps/github-as-code
6 changes: 6 additions & 0 deletions apps/github-as-code/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ move: ## move resource
$(terraform_project_cmd) state mv \
'github_repository.admin' 'module.admin.github_repository.main'

ci: ## ci
$(terraform_project_cmd) init
$(terraform_project_cmd) fmt -check
$(terraform_project_cmd) plan -input=false

cd: ## cd
$(terraform_project_cmd) apply -auto-approve -input=false

0 comments on commit a39d04d

Please sign in to comment.