Skip to content

new rule: deprecated_lookup#128

Merged
bendrucker merged 3 commits into
terraform-linters:mainfrom
Miouge1:deprecated-lookup
Sep 13, 2023
Merged

new rule: deprecated_lookup#128
bendrucker merged 3 commits into
terraform-linters:mainfrom
Miouge1:deprecated-lookup

Conversation

@Miouge1

@Miouge1 Miouge1 commented Sep 13, 2023

Copy link
Copy Markdown
Contributor

lookup(map, key) is deprecated since v0.7, fix with the native map[key] syntax

@bendrucker

Copy link
Copy Markdown
Member

Nice! I'll review this later today.

@bendrucker bendrucker changed the title Add rule to disallow deprecated lookup(map, key) syntax new rule: deprecated_lookup Sep 13, 2023

@bendrucker bendrucker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@bendrucker
bendrucker merged commit 3c3ab13 into terraform-linters:main Sep 13, 2023

## Why

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compatiblity -> compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants