Skip to content

Commit

Permalink
add OriginForTarget for stack variable references in deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarm committed Aug 15, 2024
1 parent 6894084 commit 827296a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions schema/stacks/deploy_schema_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package schema
import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
tfschema "github.com/hashicorp/terraform-schema/schema"
"github.com/hashicorp/terraform-schema/stack"
"github.com/zclconf/go-cty/cty"
Expand Down Expand Up @@ -51,6 +52,21 @@ func constraintForDeploymentInputs(stackMeta stack.Meta) (schema.Constraint, err
aSchema := StackVarToAttribute(variable)
aSchema.Constraint = tfschema.ConvertAttributeTypeToConstraint(varType)

aSchema.OriginForTarget = &schema.PathTarget{
Address: schema.Address{
schema.StaticStep{Name: "var"},
schema.AttrNameStep{},
},
Path: lang.Path{
Path: stackMeta.Path,
LanguageID: tfschema.StackLanguageID,
},
Constraints: schema.Constraints{
ScopeId: refscope.VariableScope,
Type: varType,
},
}

inputs[name] = aSchema
}

Expand Down

0 comments on commit 827296a

Please sign in to comment.