chore: matyasjay team-one-beyond-employees member #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Plan Terraform | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.6 | |
- name: Run terraform fmt check | |
run: find . -type f -name '*.tf' -exec terraform fmt -check -diff {} \; | |
plan: | |
name: Plan | |
env: | |
TF_VAR_allowed_account_id: ${{ secrets.ALLOWED_ACCOUNT_ID }} | |
TF_VAR_github_token: ${{ secrets.TOKEN }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.6 | |
- name: Terraform Init | |
run: | | |
terraform init \ | |
-backend-config="access_key=${AWS_ACCESS_KEY_ID}" \ | |
-backend-config="secret_key=${AWS_SECRET_ACCESS_KEY}" \ | |
-input=false \ | |
-no-color | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Plan Terraform | |
id: plan | |
run: terraform plan -input=false -no-color | |
- name: Post Plan to GitHub PR | |
uses: mshick/add-pr-comment@v1 | |
with: | |
allow-repeats: true | |
repo-token: ${{ secrets.TOKEN }} | |
repo-token-user-login: "github-actions[bot]" | |
message: | | |
## Terraform plan | |
``` | |
${{ steps.plan.outputs.stdout || steps.plan.outputs.stderr }} | |
``` |