You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While it's possible to declare count and for_each in a resource (and other) block, the configuration is not valid. We can catch this early in the enhanced validation.
Trying to run the above configuration does not work. terraform validate will report this as an error:
╷
│ Error: Invalid combination of "count" and "for_each"
│
│ on main.tf line 25, in resource "aws_instance" "name":
│ 25: for_each = {
│
│ The "count" and "for_each" meta-arguments are mutually-exclusive, only one should be used to be explicit about the number of resources to be created.
╵
Proposal
Add a new validator in terraform-ls that checks if both attributes are present and raises a diagnostic
The text was updated successfully, but these errors were encountered:
Context
While it's possible to declare
count
andfor_each
in a resource (and other) block, the configuration is not valid. We can catch this early in the enhanced validation.Trying to run the above configuration does not work.
terraform validate
will report this as an error:Proposal
The text was updated successfully, but these errors were encountered: