-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (48 loc) · 1.5 KB
/
provision.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Provision three tier architecture using terraform
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
provision-three-tier:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_key }}
TF_VAR_awskey01: ${{ secrets.ssh_private_key }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: setup the Packer
id: setup
uses: hashicorp/setup-packer@main
- name: initialize packer
id: initpacker
run: "packer init ./image-builder/"
- name: fmt packer
id: fmtpacker
run: "packer fmt ./image-builder/"
- name: validate packer
id: validate
run: "packer validate ./image-builder/"
- name: build image
id: build
run: "packer build ./image-builder/"
- name: set up terraform
uses: hashicorp/setup-terraform@v2
id: setupterraform
- name: terraform init
id: initailizeterraform
run: terraform init
- name: format terraform
id: formatterraform
run: terraform fmt
- name: terraform validate
id: validateterraform
run: terraform validate
- name: terraform plan
id: plan
run: terraform plan -input=false
- name: terraform apply
id: apply
run: terraform apply --auto-approve