Description
Context
Whilst working on #241, #232 (f2c8ee0 specifically) and investigating #170 it became clear that we need some more effective way to express that an attribute takes multiple types and/or scopes.
This function also expresses the problem:
hcl-lang/decoder/expr_one_of_ref_origins.go
Lines 28 to 59 in d2c7ba3
There are currently some known use cases in Terraform schema:
for_each
- map or setdepends_on
- multiple scopes (data, module, resource)
hcl-lang/decoder/extension_schemas.go
Lines 23 to 33 in d2c7ba3
See also https://github.com/search?q=repo%3Ahashicorp%2Fterraform-schema+OfScopeId&type=code
Proposal
We should explore some more elegant ways of expressing such a constraint.
One possible solution would be to just introduce plural version OfType
and OfScopeId
, where validation ensures that either singular or plural is used (not both).