This repository has been archived by the owner on Dec 22, 2024. It is now read-only.
Deploy with Terraform #18
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: Deploy with Terraform | |
on: | |
workflow_run: | |
workflows: ["Build and Push Docker"] | |
types: | |
- completed | |
jobs: | |
terraform-deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Decode GCP Credentials | |
run: echo "${{ secrets.GCP_SA_KEY }}" | base64 --decode > gcp-credentials.json | |
shell: bash | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Terraform Init | |
run: terraform init | |
working-directory: ./terraform | |
- name: Terraform Plan | |
run: terraform plan -out=tfplan | |
working-directory: ./terraform | |
- name: Terraform Apply | |
run: terraform apply -auto-approve tfplan | |
env: | |
TF_VAR_gcp_project_id: ${{ secrets.GCP_PROJECT_ID }} | |
TF_VAR_docker_image_url: "hankcmoody/varonis-rest-rec:${{ github.sha }}" | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/gcp-credentials.json | |
working-directory: ./terraform |