Skip to content

Commit e6651cc

Browse files
committed
Add terraform_deprecated_lookup rule to the recommended preset
1 parent 6afcb25 commit e6651cc

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

docs/rules/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ All rules are enabled by default, but by setting `preset = "recommended"`, you c
99
|[terraform_comment_syntax](terraform_comment_syntax.md)|Disallow `//` comments in favor of `#`||
1010
|[terraform_deprecated_index](terraform_deprecated_index.md)|Disallow legacy dot index syntax||
1111
|[terraform_deprecated_interpolation](terraform_deprecated_interpolation.md)|Disallow deprecated (0.11-style) interpolation||
12-
|[terraform_deprecated_lookup](terraform_deprecated_lookup.md)|Disallow deprecated `lookup()` function with only 2 arguments.||
12+
|[terraform_deprecated_lookup](terraform_deprecated_lookup.md)|Disallow deprecated `lookup()` function with only 2 arguments.||
1313
|[terraform_documented_outputs](terraform_documented_outputs.md)|Disallow `output` declarations without description||
1414
|[terraform_documented_variables](terraform_documented_variables.md)|Disallow `variable` declarations without description||
1515
|[terraform_empty_list_equality](terraform_empty_list_equality.md)|Disallow comparisons with `[]` when checking if a collection is empty||

docs/rules/terraform_deprecated_lookup.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Disallow deprecated [`lookup` function](https://developer.hashicorp.com/terraform/language/functions/lookup) usage without a default.
44

5+
> This rule is enabled by "recommended" preset.
6+
57
## Example
68

79
```hcl
@@ -25,7 +27,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0
2527

2628
## Why
2729

28-
Calling [`lookup`](https://developer.hashicorp.com/terraform/language/functions/lookup) with 2 arguments has been deprecated since Terraform v0.7. `lookup(map, key)` is equivalent to the native index syntax `map[key]`. `lookup` should only be used with the third `default` argument, even though it is optional for backward compatiblity.
30+
Calling [`lookup`](https://developer.hashicorp.com/terraform/language/functions/lookup) with 2 arguments has been deprecated since Terraform v0.7. `lookup(map, key)` is equivalent to the native index syntax `map[key]`. `lookup` should only be used with the third `default` argument, even though it is optional for backward compatibility.
2931

3032
## How To Fix
3133

rules/preset.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var PresetRules = map[string][]tflint.Rule{
77
NewTerraformCommentSyntaxRule(),
88
NewTerraformDeprecatedIndexRule(),
99
NewTerraformDeprecatedInterpolationRule(),
10+
NewTerraformDeprecatedLookupRule(),
1011
NewTerraformDocumentedOutputsRule(),
1112
NewTerraformDocumentedVariablesRule(),
1213
NewTerraformEmptyListEqualityRule(),
@@ -20,11 +21,11 @@ var PresetRules = map[string][]tflint.Rule{
2021
NewTerraformUnusedDeclarationsRule(),
2122
NewTerraformUnusedRequiredProvidersRule(),
2223
NewTerraformWorkspaceRemoteRule(),
23-
NewTerraformDeprecatedLookupRule(),
2424
},
2525
"recommended": {
2626
NewTerraformDeprecatedIndexRule(),
2727
NewTerraformDeprecatedInterpolationRule(),
28+
NewTerraformDeprecatedLookupRule(),
2829
NewTerraformEmptyListEqualityRule(),
2930
NewTerraformModulePinnedSourceRule(),
3031
NewTerraformModuleVersionRule(),

0 commit comments

Comments
 (0)