Skip to content

Commit

Permalink
Fix the way we target linting at specific path (#4118)
Browse files Browse the repository at this point in the history
* Fix the way we target linting at specific path

* split out core tag validation

---------

Co-authored-by: Tamir Kamara <[email protected]>
Co-authored-by: Tim Allen <[email protected]>
  • Loading branch information
3 people authored Nov 5, 2024
1 parent d259370 commit f91bdd1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .github/linters/.tflint.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,3 @@ rule "terraform_naming_convention" {
rule "terraform_standard_module_structure" {
enabled = true
}

rule "azurerm_resource_missing_tags" {
enabled = true
tags = ["tre_id"]
}
19 changes: 19 additions & 0 deletions .github/linters/.tflint_core.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This is used for TRE tags validation only.

config {
module = true
force = false
}

plugin "azurerm" {
enabled = true
}

rule "terraform_typed_variables" {
enabled = false
}

rule "azurerm_resource_missing_tags" {
enabled = true
tags = ["tre_id"]
}
22 changes: 18 additions & 4 deletions .github/workflows/build_validation_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
docs:
- 'docs/**/*'
terraform_core:
- core/**/terraform/**/*.tf
terraform_workspaces:
- templates/workspaces/**/terraform/**/*.tf
Expand Down Expand Up @@ -95,6 +98,17 @@ jobs:
pip install -r docs/requirements.txt
mkdocs build --strict
- name: Core Tags
if: ${{ steps.filter.outputs.terraform_core == 'true' }}
uses: github/super-linter/[email protected]
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_core.hcl
FILTER_REGEX_INCLUDE: './core/.*'

- name: Workspace Tags
if: ${{ steps.filter.outputs.terraform_workspaces == 'true' }}
uses: github/super-linter/[email protected]
Expand All @@ -104,7 +118,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_workspaces.hcl
LINTER_REGEX_INCLUDE: './templates/workspaces/.*'
FILTER_REGEX_INCLUDE: './templates/workspaces/.*'

- name: Workspace Services Tags
if: ${{ steps.filter.outputs.terraform_workspace_services == 'true' }}
Expand All @@ -115,7 +129,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_workspace_services.hcl
LINTER_REGEX_INCLUDE: './templates/workspaces/.*'
FILTER_REGEX_INCLUDE: './templates/workspaces/.*'
FILTER_REGEX_EXCLUDE: '.*user_resource.*'

- name: User Resources Tags
Expand All @@ -127,7 +141,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_user_resources.hcl
LINTER_REGEX_INCLUDE: './templates/workspace_services/.*/user_resources/.*'
FILTER_REGEX_INCLUDE: './templates/workspace_services/.*/user_resources/.*'

- name: Shared Services Tags
if: ${{ steps.filter.outputs.terraform_shared_services == 'true' }}
Expand All @@ -138,4 +152,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_shared_services.hcl
LINTER_REGEX_INCLUDE: './templates/shared_services/.*'
FILTER_REGEX_INCLUDE: './templates/shared_services/.*'

0 comments on commit f91bdd1

Please sign in to comment.