Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new rule: deprecated_lookup #128

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

Miouge1
Copy link
Contributor

@Miouge1 Miouge1 commented Sep 13, 2023

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

@bendrucker
Copy link
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
Copy link
Member

@bendrucker bendrucker left a comment

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
2 checks passed

## 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.

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