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

terraformrules: Walk map/list expressions deeply #1432

Merged
merged 1 commit into from
Jul 10, 2022
Merged

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Jul 9, 2022

Fixes #1257

Previously, WalkExpressions visited expressions based on the structure parsed by Terraform's internal API. Therefore, when the expression is nested in an expression such as map or list, there is an issue that it is not possible to walk the nested expression correctly.

This PR changes to use the HCL's native Walk function instead of the structure parsed by Terraform's internal API to walk expressions deeply. Note that this change will inspect the overridden configuration. This is because all files are inspected, regardless of Terraform semantics.

Also, there are some caveats when walking the JSON expressions. Unlike the native HCL syntax, the JSON syntax does not provide a Walk function, so we cannot walk for an expression in an expression. This has room for improvement, but at this point, it only walks top-level expressions. Therefore, it is possible that a wider range than the original expression range will be reported.

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.

terraform_deprecated_interpolation: deeply inspect map/list attributes
1 participant