From 155a8c54dbe28ec2dd647d79db7ad6daa534b55d Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Tue, 6 Aug 2024 17:29:40 +0200 Subject: [PATCH] feat: add Address to variable block schema for stacks to enable references --- internal/schema/stacks/1.9/variable_block.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/schema/stacks/1.9/variable_block.go b/internal/schema/stacks/1.9/variable_block.go index 5ecdb80e..d472977d 100644 --- a/internal/schema/stacks/1.9/variable_block.go +++ b/internal/schema/stacks/1.9/variable_block.go @@ -6,12 +6,25 @@ package schema import ( "github.com/hashicorp/hcl-lang/lang" "github.com/hashicorp/hcl-lang/schema" + "github.com/hashicorp/terraform-schema/internal/schema/refscope" "github.com/hashicorp/terraform-schema/internal/schema/tokmod" "github.com/zclconf/go-cty/cty" ) func variableBlockSchema() *schema.BlockSchema { return &schema.BlockSchema{ + Address: &schema.BlockAddrSchema{ + Steps: []schema.AddrStep{ + schema.StaticStep{Name: "var"}, + schema.LabelStep{Index: 0}, + }, + FriendlyName: "variable", + ScopeId: refscope.VariableScope, + AsReference: true, + AsTypeOf: &schema.BlockAsTypeOf{ + AttributeExpr: "type", + }, + }, SemanticTokenModifiers: lang.SemanticTokenModifiers{tokmod.Variable}, Labels: []*schema.LabelSchema{ {