Skip to content

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

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