Any call to .AtName()
, .AtListIndex()
, etc. removes the root
flag on root expressions
#419
Labels
Milestone
Module version
Description
For a terraform configuration like:
If we need to express that
url
conflicts withfrom_env
, we need to write in the schema of the provider something like:Both approaches should work, but unfortunately the calls to
AtName()
(and any other.At*
method on apath.Expression
) make use.Copy()
, and that call inadvertently modifies the expression so that, if internally it contained the flagroot: true
, by virtue of Golang default values, it gets turned toroot: false
:Because of this, the provider validation logic triggers an error when using the "absolute path" approach:
Expected Behavior
Validation should be express-able via "absolute" as well as "relative" paths.
The choice should be left to the provider developer.
Actual Behavior
Any "absolute" path expression (i.e. created via
.MatchRoot()
, i.e. that contain internally theroot: true
flag), when deeper than 1 level, assemble an incorrect expression, where the "root-ness" gets lost.The text was updated successfully, but these errors were encountered: