In today's OpenTofu we consider it an immediate error if we can't determine
which instances are declared for a module call or resource, but in future
we'd like to be able to do something better that involves modeling the
fact that we weren't able to expand something but still being able to make
some predictions about how it will turn out anyway.
These new concepts of "wildcard" instance key and "placeholder" module
instance or resource instance addresses give us a way to represent those
situations elsewhere in the system, although as of this commit nothing is
using these yet.
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
So far we've only ever needed to re-parse address strings that happen not
to contain instance keys and so we've gotten away with our serialization
of these not being quite right, but given how liberally we've expected to
be able to use address strings from this package for wire format
interchange it seems likely that this is going to surprise us eventually.
Now we'll use an escaping scheme compatible with HCL's parser rather
than Go's parser, and so we can safely rely on hclsyntax.ParseTraversal
as part of reversing this operation to transform an address string back
into an address equivalent to the value it was created from.
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.
If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.