-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (74 loc) · 2.31 KB
/
ci.yml
File metadata and controls
89 lines (74 loc) · 2.31 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: CI
on:
pull_request:
paths:
- "**.tf"
- "tests/**"
- "schemas/**"
- "docs/reference/**"
- ".terraform-docs.yml"
- ".github/workflows/ci.yml"
- "!topologies/**"
push:
branches: [main]
paths:
- "**.tf"
- "tests/**"
- "schemas/**"
- "docs/reference/**"
- ".terraform-docs.yml"
- "!topologies/**"
permissions:
contents: read
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
with:
terraform_version_file: .terraform-version
- name: Cache Terraform providers
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: .terraform
key: terraform-${{ hashFiles('.terraform.lock.hcl') }}
restore-keys: terraform-
- name: Format check
run: terraform fmt -check -recursive
- name: Init
run: terraform init -backend=false
- name: Set up tflint
uses: terraform-linters/setup-tflint@90f302c255ef959cbfb4bd10581afecdb7ece3e6 # v4
with:
tflint_version: latest
- name: Lint
run: |
tflint --init
tflint --recursive
- name: Test (mock providers)
run: terraform test
docs:
name: Docs up to date
runs-on: ubuntu-latest
env:
TERRAFORM_DOCS_VERSION: v0.20.0
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install terraform-docs
run: |
wget -q -O /tmp/terraform-docs.tar.gz \
https://github.com/terraform-docs/terraform-docs/releases/download/${TERRAFORM_DOCS_VERSION}/terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz
tar -xzf /tmp/terraform-docs.tar.gz -C /tmp
sudo mv /tmp/terraform-docs /usr/local/bin/
chmod +x /usr/local/bin/terraform-docs
- name: Regenerate docs
run: make docs
- name: Check for drift
run: |
if ! git diff --exit-code docs/reference/; then
echo ""
echo "Docs are out of date. Run 'make docs' locally and commit the result."
exit 1
fi