-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (45 loc) · 1.27 KB
/
ci.yml
File metadata and controls
55 lines (45 loc) · 1.27 KB
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
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch: # enable manual execution
env:
TERRAFORM_VERSION: 1.10.5
TERRAFORM_AWS_PROVIDER_VERSION: 5.84.0
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v6
- name: Create terraform.tf
env:
TF_FILE: "terraform.tf"
run: |
CONTENT="terraform {\n"
CONTENT+=" required_version = \"${TERRAFORM_VERSION}\"\n"
CONTENT+=" required_providers {\n"
CONTENT+=" aws = {\n"
CONTENT+=" source = \"hashicorp/aws\"\n"
CONTENT+=" version = \"${TERRAFORM_AWS_PROVIDER_VERSION}\"\n"
CONTENT+=" }\n"
CONTENT+=" }\n"
CONTENT+="}\n"
echo -e "${CONTENT}" > "${TF_FILE}"
cat "${TF_FILE}"
- name: Setup Terraform
uses: hashicorp/setup-terraform@v4
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Terraform format check
run: terraform fmt -check -recursive .
- name: Terraform init
run: terraform init -backend=false
- name: Terraform validate
run: terraform validate