-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add github actions to lint dashboards
- Loading branch information
1 parent
31f8f47
commit 32ca163
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Automatic CI for TFE Modules | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
terraform_format: | ||
|
||
name: Run terraform fmt | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
persist-credentials: false | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: 1.0.11 | ||
|
||
- name: Format all .tf files recursively | ||
run: | | ||
terraform fmt -check -diff -recursive ${{ github.workspace }} | ||
terraform_lint: | ||
|
||
name: Run terraform-lint | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
persist-credentials: false | ||
|
||
- name: Setup Terraform Lint | ||
uses: terraform-linters/setup-tflint@v1 | ||
with: | ||
tflint_version: v0.34.1 | ||
|
||
- name: Terraform Init | ||
id: init | ||
run: | | ||
terraform init | ||
- name: Lint root module | ||
run: | | ||
tflint --config ${{ github.workspace }}/.tflint.hcl ${{ github.workspace }} | ||
- name: Lint collector-dashboards directory in a loop | ||
run: | | ||
for m in $(ls -1d collector-dashboards/*/) | ||
do | ||
tflint \ | ||
--config ${{ github.workspace }}/.tflint.hcl \ | ||
${{ github.workspace }}/${m} | ||
done | ||
- name: Lint examples directory in a loop | ||
run: | | ||
for m in $(ls -1d examples/*/) | ||
do | ||
tflint \ | ||
--config ${{ github.workspace }}/.tflint.hcl \ | ||
${{ github.workspace }}/${m} | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
config { | ||
module = true | ||
} | ||
|
||
rule "terraform_deprecated_index" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_unused_declarations" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_comment_syntax" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_documented_outputs" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_documented_variables" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_typed_variables" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_naming_convention" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_required_version" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_required_providers" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_unused_required_providers" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_standard_module_structure" { | ||
enabled = true | ||
} |