Manually Provision Terraform #11
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: "Manual Terraform Deployment" | |
on: | |
workflow_dispatch: | |
jobs: | |
terraform: | |
name: "Provision Terraform" | |
runs-on: ubuntu-latest | |
# environment: | |
# name: ${{ github.event.inputs.environment }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
service_account_key: ${{ secrets.DEFAULT_SA_KEY2 }} | |
project_id: ${{ secrets.PROJECT_ID }} | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: "Setup GCP Credentials" | |
env: | |
GCP_SA_KEY: ${{ secrets.DEFAULT_SA_KEY2 }} | |
run: | | |
echo "$GCP_SA_KEY" > credentials.json | |
echo "$GCP_SA_KEY" | |
# - name: Decode GCP Credentials | |
# run: | | |
# echo '${{ secrets.GCP_SA_KEY_BASE64 }}' | base64 -d > ${{ github.workspace }}/cloud-infra/automateml-3f20c67d2a0a.json | |
# cat ${{ github.workspace }}/cloud-infra/automateml-3f20c67d2a0a.json | |
# echo '${{ secrets.GCP_SA_KEY_BASE64 }}' | |
# env: | |
# GCP_SA_KEY_BASE64: ${{ secrets.GCP_SA_KEY_BASE64 }} | |
- name: Terraform Init | |
working-directory: ./cloud-infra | |
run: | | |
terraform init | |
- name: Terraform Format | |
working-directory: ./cloud-infra | |
run: | | |
terraform fmt -check | |
- name: Terraform Plan | |
working-directory: ./cloud-infra | |
run: | | |
terraform plan | |
- name: Hold for approval | |
if: github.event_name == 'workflow_dispatch' | |
uses: softprops/turnstyle@v1 | |
with: | |
continue-after-seconds: 0 # This will make it wait indefinitely until manually approved | |
poll-interval-seconds: 10 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Terraform Apply | |
working-directory: ./cloud-infra | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
terraform apply -auto-approve |