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

decoder: allow objects in for_each #333

Merged
merged 1 commit into from
Oct 11, 2023
Merged

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Oct 11, 2023

Related to:


Relevant LOC in Terraform: https://github.com/hashicorp/terraform/blob/07b814c030daae39dea764571bef9cecf26e49be/internal/terraform/eval_for_each.go#L275-L284

As the in-line comment says:

Objects are still supported for backwards-compatible reasons but in general should be avoided. We add it here because otherwise valid configuration would be flagged as invalid. We cannot suppress it in completion (yet) or otherwise inform the user of this anti-pattern though.

Before

Screenshot 2023-10-11 at 15 28 32

After

Screenshot 2023-10-11 at 15 28 49

Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

LGTM!

Too bad we can't suppress it on completion. Should we create a follow-up ticket for that?

@radeksimko
Copy link
Member Author

Too bad we can't suppress it on completion. Should we create a follow-up ticket for that?

Yes - I think it should probably get suppressed in hover data as well. We could also consider separate explicit warning or info diagnostic to discourage users from using objects in that context.

I will create a ticket and track it on my TODOs in the meantime.

@radeksimko radeksimko merged commit 6ec57d4 into main Oct 11, 2023
5 checks passed
@radeksimko radeksimko deleted the b-for_each-allow-object branch October 11, 2023 16:13
@radeksimko
Copy link
Member Author

Follow-up issue created: hashicorp/terraform-ls#1473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants