Skip to content

Commit 39ccc95

Browse files
committed
Adding ci
1 parent 48a7c58 commit 39ccc95

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build IaC
2+
3+
on:
4+
push:
5+
branch:
6+
- master
7+
8+
repository_dispatch:
9+
types: [build]
10+
11+
env:
12+
# Terraform
13+
TERRAFORM_VERSION: '0.12.29'
14+
15+
# AWS
16+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
17+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
18+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+
20+
jobs:
21+
terraform:
22+
name: Terraform Deploy
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Setup Terraform
27+
uses: hashicorp/setup-terraform@v1
28+
with:
29+
terraform_version: ${{ env.TERRAFORM_VERSION }}
30+
terraform_wrapper: false
31+
32+
- name: Checkout
33+
uses: actions/checkout@master
34+
35+
- name: Terraform Init
36+
run: terraform init
37+
38+
- name: Terraform Format
39+
run: terraform fmt -check
40+
41+
- name: Terraform Validate
42+
run: terraform validate
43+
44+
- name: Terraform Plan
45+
run: terraform plan
46+
47+
- name: Terraform Apply
48+
run: terraform apply -auto-approve

.github/workflows/destroy.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Destroy IaC
2+
3+
on:
4+
repository_dispatch:
5+
types: [destroy]
6+
7+
env:
8+
# Terraform
9+
TERRAFORM_VERSION: '0.12.29'
10+
11+
# AWS
12+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
13+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
14+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
15+
16+
jobs:
17+
terraform:
18+
name: Terraform Deploy
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: 'Checkout'
23+
uses: actions/checkout@master
24+
25+
- name: Setup Terraform
26+
uses: hashicorp/setup-terraform@v1
27+
with:
28+
terraform_version: ${{ env.TERRAFORM_VERSION }}
29+
terraform_wrapper: false
30+
31+
- name: Terraform Destroy
32+
run: |
33+
terraform init
34+
terraform destroy -auto-approve

0 commit comments

Comments
 (0)