Skip to content

Commit f91bdd1

Browse files
tamirkamaraTamir KamaraTim Allen
authored
Fix the way we target linting at specific path (#4118)
* 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]>
1 parent d259370 commit f91bdd1

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

.github/linters/.tflint.hcl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,3 @@ rule "terraform_naming_convention" {
3030
rule "terraform_standard_module_structure" {
3131
enabled = true
3232
}
33-
34-
rule "azurerm_resource_missing_tags" {
35-
enabled = true
36-
tags = ["tre_id"]
37-
}

.github/linters/.tflint_core.hcl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This is used for TRE tags validation only.
2+
3+
config {
4+
module = true
5+
force = false
6+
}
7+
8+
plugin "azurerm" {
9+
enabled = true
10+
}
11+
12+
rule "terraform_typed_variables" {
13+
enabled = false
14+
}
15+
16+
rule "azurerm_resource_missing_tags" {
17+
enabled = true
18+
tags = ["tre_id"]
19+
}

.github/workflows/build_validation_develop.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
docs:
4141
- 'docs/**/*'
4242
43+
terraform_core:
44+
- core/**/terraform/**/*.tf
45+
4346
terraform_workspaces:
4447
- templates/workspaces/**/terraform/**/*.tf
4548
@@ -95,6 +98,17 @@ jobs:
9598
pip install -r docs/requirements.txt
9699
mkdocs build --strict
97100
101+
- name: Core Tags
102+
if: ${{ steps.filter.outputs.terraform_core == 'true' }}
103+
uses: github/super-linter/[email protected]
104+
env:
105+
VALIDATE_ALL_CODEBASE: false
106+
DEFAULT_BRANCH: main
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
VALIDATE_TERRAFORM_TFLINT: true
109+
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_core.hcl
110+
FILTER_REGEX_INCLUDE: './core/.*'
111+
98112
- name: Workspace Tags
99113
if: ${{ steps.filter.outputs.terraform_workspaces == 'true' }}
100114
uses: github/super-linter/[email protected]
@@ -104,7 +118,7 @@ jobs:
104118
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105119
VALIDATE_TERRAFORM_TFLINT: true
106120
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_workspaces.hcl
107-
LINTER_REGEX_INCLUDE: './templates/workspaces/.*'
121+
FILTER_REGEX_INCLUDE: './templates/workspaces/.*'
108122

109123
- name: Workspace Services Tags
110124
if: ${{ steps.filter.outputs.terraform_workspace_services == 'true' }}
@@ -115,7 +129,7 @@ jobs:
115129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116130
VALIDATE_TERRAFORM_TFLINT: true
117131
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_workspace_services.hcl
118-
LINTER_REGEX_INCLUDE: './templates/workspaces/.*'
132+
FILTER_REGEX_INCLUDE: './templates/workspaces/.*'
119133
FILTER_REGEX_EXCLUDE: '.*user_resource.*'
120134

121135
- name: User Resources Tags
@@ -127,7 +141,7 @@ jobs:
127141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128142
VALIDATE_TERRAFORM_TFLINT: true
129143
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_user_resources.hcl
130-
LINTER_REGEX_INCLUDE: './templates/workspace_services/.*/user_resources/.*'
144+
FILTER_REGEX_INCLUDE: './templates/workspace_services/.*/user_resources/.*'
131145

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

0 commit comments

Comments
 (0)