-
Notifications
You must be signed in to change notification settings - Fork 10
54 lines (44 loc) · 1.5 KB
/
manual_terraform.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 'Manual Terraform Deployment'
on:
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
default: 'dev'
jobs:
terraform:
name: 'Deploy to Environment'
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.1
with:
service_account_key: ${{ secrets.DEFAULT_SA_KEY2 }}
project_id: ${{ secrets.PROJECT_ID }}
- name: Install Terraform
uses: hashicorp/setup-terraform@v1
- name: Decode GCP Credentials
run: |
echo '${{ secrets.GCP_SA_KEY_BASE64 }}' | base64 -d > ${{ github.workspace }}/automateml-3f20c67d2a0a.json
env:
GCP_SA_KEY_BASE64: ${{ secrets.GCP_SA_KEY_BASE64 }}
- name: Terraform Init
run: terraform init
- name: Terraform Plan
run: terraform plan -out=tfplan
- 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
if: github.event_name == 'workflow_dispatch'
run: terraform apply tfplan