Terraform Deployment #1045
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 Deployment" | |
on: | |
workflow_run: | |
workflows: [Cloud-Functions Infrastructure Deploy] | |
types: | |
- completed | |
#push: | |
# branches: ["master"] | |
workflow_dispatch: | |
branches: ["master"] | |
permissions: | |
contents: read | |
jobs: | |
terraform: | |
name: "Terraform Deployment" | |
runs-on: ubuntu-latest | |
environment: production | |
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token | |
- name: Setup Terraform | |
uses: hashicorp/[email protected] | |
with: | |
cli_config_credentials_token: ${{ secrets.GCP_CREDENTIALS }} | |
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. | |
- name: Init | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
run: terraform init --upgrade | |
#- name: Unlock | |
# env: | |
# GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
# run: terraform force-unlock -force 1685350252766491 | |
#- name: Terraform Init | |
# env: | |
# GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
# run: terraform force-unlock -force 1682362752857559 | |
# Generates an execution plan for Terraform | |
#- name: Terraform Plan | |
# env: | |
# GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
# run: terraform plan -input=false | |
# On push to "master", build or change infrastructure according to Terraform configuration files | |
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks | |
- name: Terraform Apply | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
run: terraform apply -auto-approve -input=false -var="token_bypass=${{ secrets.TOKEN_BYPASS }}" -var="slack_signing_secret=${{ secrets.SLACK_SIGNING_SECRET }}" -var="slack_bot_token=${{ secrets.SLACK_BOT_TOKEN}}" |