✨ Streamer varsel-tabellen til bigquery #167
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: "Terraform" | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- './README.md' | |
env: | |
DEV_DIR: './dev' | |
PROD_DIR: './prod' | |
jobs: | |
terraform-plan-dev: | |
name: "terraform plan gcp-dev" | |
runs-on: ubuntu-latest | |
concurrency: terraform-plan-dev | |
defaults: | |
run: | |
working-directory: ${{ env.DEV_DIR }} | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_SECRET_DEV }} | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: Run 'terraform setup' | |
uses: hashicorp/setup-terraform@v3 | |
- name: Run 'terraform init' | |
run: terraform init | |
- name: Run 'terraform fmt' | |
run: terraform fmt -check | |
- name: Run 'terraform validate' | |
run: terraform validate | |
- name: Run 'terraform plan' | |
run: terraform plan | |
terraform-plan-prod: | |
name: "terraform plan gcp-prod" | |
runs-on: ubuntu-latest | |
concurrency: terraform-plan-prod | |
defaults: | |
run: | |
working-directory: ${{ env.PROD_DIR }} | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_SECRET_PROD }} | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: Run 'terraform setup' | |
uses: hashicorp/setup-terraform@v3 | |
- name: Run 'terraform init' | |
run: terraform init | |
- name: Run 'terraform fmt' | |
run: terraform fmt -check | |
- name: Run 'terraform validate' | |
run: terraform validate | |
- name: Run 'terraform plan' | |
run: terraform plan | |
terraform-apply-dev: | |
needs: terraform-plan-dev | |
name: "terraform apply gcp-dev" | |
runs-on: ubuntu-latest | |
concurrency: terraform-plan-dev, terraform-apply-dev | |
defaults: | |
run: | |
working-directory: ${{ env.DEV_DIR }} | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_SECRET_DEV }} | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: Run 'terraform setup' | |
uses: hashicorp/setup-terraform@v3 | |
- name: Run 'terraform init' | |
run: terraform init | |
- name: Run 'terraform apply' | |
run: terraform apply -auto-approve | |
terraform-apply-prod: | |
needs: terraform-plan-prod | |
name: "terraform apply gcp-prod" | |
runs-on: ubuntu-latest | |
concurrency: terraform-plan-prod, terraform-apply-prod | |
defaults: | |
run: | |
working-directory: ${{ env.PROD_DIR }} | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_SECRET_PROD }} | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: Run 'terraform setup' | |
uses: hashicorp/setup-terraform@v3 | |
- name: Run 'terraform init' | |
run: terraform init | |
- name: Run 'terraform apply' | |
run: terraform apply -auto-approve |