Skip to content

Project ID removed from config #13

Project ID removed from config

Project ID removed from config #13

Workflow file for this run

name: Terraform CI/CD Pipeline
on:
push:
branches: ["dev", "staging", "prod"]
pull_request:
branches: ["dev", "staging", "prod"]
jobs:
terraform:
name: "Terraform - ${{ github.ref_name }}"
runs-on: ubuntu-latest
env:
TF_VAR_project_id: ${{ secrets.GCP_PROJECT_ID }}
TF_VAR_region: ${{ secrets.GCP_REGION }}
GOOGLE_CLOUD_PROJECT: ${{ secrets.GCP_PROJECT_ID }}
defaults:
run:
working-directory: .
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: Terraform Init (GCS Backend)
run: terraform init -backend-config="envs/${{ github.ref_name }}/backend.config"
- name: Terraform Validate
run: terraform validate
- name: Terraform Format Check
run: terraform fmt -check -recursive
- name: Terraform Plan
run: terraform plan -var-file="envs/${{ github.ref_name }}/terraform.tfvars" -out=tfplan.binary
- name: Show Terraform Plan
run: terraform show -no-color tfplan.binary