-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (43 loc) · 1.99 KB
/
terraform_deploy.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
name: Terraform Deploy
# Use terraform to deploy the previously published docker image
on:
repository_dispatch:
types: [start-terraform-deploy]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: SmartColumbusOS/scos-tf-backends
token: ${{ secrets.ORG_PAT }}
path: shared
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.12.31
- name: Terraform Staging Init
if: github.event.client_payload.release_tag_name != 'prod'
run: ./shared/scripts/tf-init -w staging
- name: Terraform Prod Init
if: github.event.client_payload.release_tag_name == 'prod'
run: ./shared/scripts/tf-init -w prod
- name: Deploy to Staging with Terraform
if: github.event.client_payload.release_tag_name != 'prod'
env:
TF_VAR_os_role_arn: ${{secrets.STAGING_ROLE_ARN}}
TF_VAR_docker_img_tag: ${{ github.event.client_payload.release_tag_name }}
run: terraform apply --var="force_deployment="$RANDOM -auto-approve
- name: Deploy to Prod with Terraform
if: github.event.client_payload.release_tag_name == 'prod'
env:
TF_VAR_os_role_arn: ${{secrets.PROD_ROLE_ARN}}
TF_VAR_docker_img_tag: ${{ github.event.client_payload.release_tag_name }}
run: terraform apply --var="force_deployment="$RANDOM -auto-approve