Apply Terraform on Google Cloud #4
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: Apply Terraform on Google Cloud | |
on: | |
workflow_run: | |
workflows: ["Build and Push Docker Image"] | |
types: | |
- completed | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Change directory to Terraform configuration | |
run: cd terraform/prod | |
- name: Set up gcloud CLI | |
uses: google-github-actions/[email protected] | |
with: | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.0.0 | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Apply | |
run: | | |
terraform plan -out=tfplan | |
terraform apply -input=false tfplan | |
env: | |
GOOGLE_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} |