Skip to content

Commit 5568338

Browse files
committed
added github actions and tflint
1 parent 8d27270 commit 5568338

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Terraform Module CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- '**/*.tf'
8+
- '.tflint.hcl'
9+
- 'README.md'
10+
- 'LICENSE'
11+
pull_request:
12+
branches: [ main ]
13+
14+
jobs:
15+
fmt-validate:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Setup Terraform
20+
uses: hashicorp/setup-terraform@v3
21+
with:
22+
terraform_version: 1.7.5
23+
- name: Terraform fmt (check)
24+
run: terraform fmt -check -recursive
25+
- name: Validate root module
26+
run: |
27+
terraform init -backend=false
28+
terraform validate
29+
- name: Validate metric-filter submodule
30+
run: |
31+
terraform -chdir=modules/metric-filter init -backend=false
32+
terraform -chdir=modules/metric-filter validate
33+
- name: Validate subscription-filter submodule
34+
run: |
35+
terraform -chdir=modules/subscription-filter init -backend=false
36+
terraform -chdir=modules/subscription-filter validate
37+
- name: Validate examples (metric)
38+
run: |
39+
terraform -chdir=examples/metric_filter_basic init -backend=false
40+
terraform -chdir=examples/metric_filter_basic validate
41+
- name: Validate examples (subscription)
42+
run: |
43+
terraform -chdir=examples/subscription_filter_basic init -backend=false
44+
terraform -chdir=examples/subscription_filter_basic validate
45+
46+
tflint:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Setup TFLint
51+
uses: terraform-linters/setup-tflint@v4
52+
- name: TFLint init
53+
run: tflint --init || true
54+
- name: TFLint root
55+
run: tflint -c .tflint.hcl .
56+
- name: TFLint metric-filter module
57+
run: tflint -c .tflint.hcl modules/metric-filter
58+
- name: TFLint subscription-filter module
59+
run: tflint -c .tflint.hcl modules/subscription-filter
60+
- name: TFLint examples (metric)
61+
run: tflint -c .tflint.hcl examples/metric_filter_basic
62+
- name: TFLint examples (subscription)
63+
run: tflint -c .tflint.hcl examples/subscription_filter_basic
64+

.tflint.hcl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
plugin "terraform" {
2+
enabled = true
3+
}
4+
5+
# Keep linting minimal and focused for module repo
6+
rule "terraform_unused_declarations" { enabled = true }
7+
rule "terraform_deprecated_index" { enabled = true }
8+
rule "terraform_naming_convention" { enabled = false }
9+
rule "terraform_documented_outputs" { enabled = false }
10+
rule "terraform_documented_variables" { enabled = false }
11+
rule "terraform_module_pinned_source" { enabled = false }
12+
rule "terraform_required_providers" { enabled = false }
13+
rule "terraform_required_version" { enabled = false }
14+
rule "terraform_standard_module_structure" { enabled = false }
15+

0 commit comments

Comments
 (0)