-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 1.69 KB
/
pull-request.yaml
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
71
72
73
74
75
name: Pull request
on:
pull_request:
branches:
- main
jobs:
validate-terraform:
name: Validate Terraform
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.5
- name: Initialize Terraform
run: terraform init -backend=false
shell: bash
- name: Select Terraform workspace
run: terraform workspace select -or-create=true dev
shell: bash
- name: Check Terraform format
run: terraform fmt -check -list=true
shell: bash
- name: Validate code
run: terraform validate
shell: bash
preview-plan-dev:
name: Preview dev plan
uses: ./.github/workflows/deploy-terraform.yaml
with:
gith-environment: dev
terraform-workspace: dev
apply: false
needs: validate-terraform
secrets: inherit
deploy-dev:
name: Deploy dev plan
uses: ./.github/workflows/deploy-terraform.yaml
with:
gith-environment: dev
terraform-workspace: dev
apply: true
needs: preview-plan-dev
secrets: inherit
# preview-prod-plan:
# name: Preview prod plan
# uses: ./.github/workflows/deploy-terraform.yaml
# with:
# gith-environment: prod
# terraform-workspace: prod
# apply: false
# needs: deploy-dev
# secrets: inherit
# deploy-prod:
# name: Deploy prod plan
# uses: ./.github/workflows/deploy-terraform.yaml
# with:
# gith-environment: prod
# terraform-workspace: prod
# apply: true
# needs: preview-prod-plan
# secrets: inherit