Skip to content

Merge pull request #7 from vineelsai26/dependabot/terraform/terraform… #12

Merge pull request #7 from vineelsai26/dependabot/terraform/terraform…

Merge pull request #7 from vineelsai26/dependabot/terraform/terraform… #12

Workflow file for this run

name: Terraform Plan and Apply
on:
push:
branches: ["main"]
paths:
- "terraform/**"
- ".github/workflows/**"
jobs:
plan:
strategy:
matrix:
path:
["terraform/AWS/Prod", "terraform/AWS/Backup", "terraform/cloudflare"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Init
working-directory: ${{ matrix.path }}
run: terraform init
- name: Terraform Plan
working-directory: ${{ matrix.path }}
run: terraform plan
apply:
strategy:
matrix:
path:
["terraform/AWS/Prod", "terraform/AWS/Backup", "terraform/cloudflare"]
runs-on: ubuntu-latest
environment: terraform_apply
needs: plan
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Init
working-directory: ${{ matrix.path }}
run: terraform init
- name: Terraform Apply
working-directory: ${{ matrix.path }}
run: terraform apply -auto-approve