Google Analytics Integration #26
Workflow file for this run
This file contains hidden or 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: | |
- "terraform/**" | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
terraform: | |
name: 'Terraform' | |
runs-on: ubuntu-latest | |
environment: prod | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Create Backend Config | |
working-directory: ./terraform | |
run: | | |
echo "${{ secrets.REMOTE_BACKEND }}" > config.remote.tfbackend | |
echo "Config backend file created: $(cat config.remote.tfbackend)" | |
- name: Terraform Init | |
working-directory: ./terraform | |
run: | | |
terraform init -backend-config=config.remote.tfbackend | |
- name: Terraform Format | |
working-directory: ./terraform | |
run: | | |
terraform fmt -check | |
- name: Terraform Workspace | |
working-directory: ./terraform | |
run: | | |
terraform workspace select prod || terraform workspace new prod | |
- name: Terraform Plan | |
working-directory: ./terraform | |
run: | | |
terraform plan -input=false | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
working-directory: ./terraform | |
run: | | |
terraform apply -auto-approve -input=false |