Commit graph

2 commits

Author SHA1 Message Date
Lucas Bajolet
4a4b837386 hcl2template: rename Name->LocalName for local
Local variables had an attribute called Name with the name of the local
variable.

However, when producing an error while walking the DAG of
local/datasources, if an error is encountered during validation, the raw
structure of the vertex was printed out, making the error message
produced hard to understand.

Therefore in order to clean it up, we rename the `Name` attribute for
Local variables as `LocalName`, and introduce a `Name()` function for
that block so that the complete name of the variable is clearly
reported.
2024-10-29 16:10:29 -04:00
Lucas Bajolet
8e21597e30 hcl2template: add refstring type for generic refs
The hcl2template package contains references already, but these are
linked to a particular type.
This becomes problematic if we want to support cross-type references, so
this commit adds a new abstraction: refString.

A refString contains the component type, its type (if applicable), and
its name, so that the combination of those points to a cty object that
can be linked to a block in the configuration.

Right now, only `var`, `local` and `data` are supported, but the type is
extensible enough that anything else that fits this model such as
sources can be supported in the future potentially.
2024-10-29 16:10:29 -04:00