-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (37 loc) · 1.2 KB
/
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
name: Deploy and Post-Deployment Tasks
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy_terraform1:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: '1.0.0'
- name: Set up AWS environment variables from secrets
run: |
echo "TF_VAR_aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV
echo "TF_VAR_aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV
echo "TF_VAR_aws_session_token=${{ secrets.AWS_SESSION_TOKEN }}" >> $GITHUB_ENV
echo "TF_VAR_regionDefault=${{ secrets.AWS_REGION }}" >> $GITHUB_ENV
- name: Terraform Init
run: terraform init -input=false
working-directory: .
- name: Terraform Validate
run: terraform validate
working-directory: .
- name: Terraform Plan
run: terraform plan -input=false
working-directory: .
- name: Terraform Apply
run: terraform apply -auto-approve
working-directory: .
id: apply