Introduce separate testing scope for reference validation (#33339)

This commit is contained in:
Liam Cervante
2023-06-28 09:47:24 +02:00
committed by GitHub
parent dfc26c2ac4
commit 212ae6c4ba
30 changed files with 477 additions and 78 deletions

View File

@@ -10,12 +10,13 @@ import (
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/zclconf/go-cty/cty"
ctyjson "github.com/zclconf/go-cty/cty/json"
"github.com/hashicorp/terraform/internal/addrs"
"github.com/hashicorp/terraform/internal/configs/configschema"
"github.com/hashicorp/terraform/internal/lang"
"github.com/hashicorp/terraform/internal/lang/blocktoattr"
"github.com/zclconf/go-cty/cty"
ctyjson "github.com/zclconf/go-cty/cty/json"
)
// expression represents any unparsed expression
@@ -47,7 +48,7 @@ func marshalExpression(ex hcl.Expression) expression {
ret.ConstantValue = valJSON
}
refs, _ := lang.ReferencesInExpr(ex)
refs, _ := lang.ReferencesInExpr(addrs.ParseRef, ex)
if len(refs) > 0 {
var varString []string
for _, ref := range refs {