-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
217 additions
and
141 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,76 @@ | ||
name: Terraform linting | ||
on: | ||
push: | ||
paths: ['**/*.tf', '**/*.hcl', '.github/workflows/ci-terraform.yml'] | ||
env: | ||
TF_IN_AUTOMATION: true | ||
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache | ||
jobs: | ||
tflint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- name: Determine Terraform version to use | ||
uses: dflook/terraform-version@33f9a69ab2950c83a6d3a8626f35075481a64ca0 | ||
id: terraform-version | ||
|
||
- uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_version: ${{ steps.terraform-version.outputs.terraform }} | ||
terraform_wrapper: false | ||
|
||
- name: Create Terraform plugin cache dir | ||
run: mkdir -p "$TF_PLUGIN_CACHE_DIR" | ||
|
||
- name: Cache Terraform plugins | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.TF_PLUGIN_CACHE_DIR }} | ||
key: | ||
terraform-plugins-${{ runner.os }}-${{ hashFiles('**/.terraform.lock.hcl') }} | ||
|
||
- uses: actions/cache@v4 | ||
name: Cache TFLint plugins | ||
with: | ||
path: ~/.tflint.d/plugins | ||
key: tflint-${{ runner.os }}-${{ hashFiles('**/tflint.hcl') }} | ||
|
||
- uses: terraform-linters/setup-tflint@v4 | ||
name: Set up TFLint | ||
with: | ||
tflint_version: v0.47.0 | ||
|
||
- name: terraform fmt | ||
run: | | ||
if ! terraform fmt -check -diff -list=true -recursive .; then | ||
>&2 echo "Some terraform files weren't formatted correctly. Run 'terraform fmt' to fix them." | ||
exit 1 | ||
fi | ||
- name: terraform init | ||
run: | | ||
STEP_EXIT_STATUS=0 | ||
if ! terraform init -backend=false; then STEP_EXIT_STATUS=1; fi | ||
exit $STEP_EXIT_STATUS | ||
- name: terraform validate | ||
run: | | ||
STEP_EXIT_STATUS=0 | ||
if ! terraform validate; then STEP_EXIT_STATUS=1; fi | ||
exit $STEP_EXIT_STATUS | ||
- name: tflint | ||
run: | | ||
tflint --version | ||
tflint --init --recursive | ||
tflint --format compact --module --recursive --force \ | ||
--enable-rule=terraform_comment_syntax \ | ||
--enable-rule=terraform_deprecated_index \ | ||
--enable-rule=terraform_required_providers \ | ||
--enable-rule=terraform_standard_module_structure \ | ||
--enable-rule=terraform_typed_variables \ | ||
--enable-rule=terraform_unused_declarations \ | ||
--enable-rule=terraform_unused_required_providers |
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
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
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
terraform { | ||
required_providers { | ||
fastly = { | ||
source = "fastly/fastly" | ||
source = "fastly/fastly" | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.