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

Add hclext.BoundExpr #205

Merged
merged 1 commit into from
Oct 15, 2022
Merged

Add hclext.BoundExpr #205

merged 1 commit into from
Oct 15, 2022

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Oct 11, 2022

See also terraform-linters/tflint#1537

This PR introduces a concept of "bound expression". This is part of the extended hcl.Expression provided by hclext package. This expression can bind any cty.Value, and the evaluated value can be bound to the expression.

This is the mechanism needed to support each.key and count.index. When retrieved as hclext.BodyContent, all blocks must have the same raw expression representation, but when evaluated each block must return a different value depending on the context.

We achieve this behavior by binding the expanded context value to the raw expression and returning it as hclext.BodyContent.

@wata727 wata727 force-pushed the add_support_for_bound_expr branch from 0f6829b to 49187bd Compare October 12, 2022 14:42
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.

1 participant