-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (31 loc) · 988 Bytes
/
tf_apply.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
name: Terraform Apply
on:
push:
branches:
- main
env:
AWS_REGION: ${{ vars.AWS_REGION }}
jobs:
terraform-apply:
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Terraform Init
run: terraform init --backend-config=environment/dev/backend.tfvars
- name: Terraform Plan
id: plan
run: terraform plan -var-file environment/dev/terraform.tfvars -out=tfplan
- name: Terraform Apply
run: terraform apply -auto-approve tfplan
- name: Clean up plan file
run: rm -f tfplan