-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support locals in stack and deploy config (#395)
This change adds support for locals in stack and deployment configuration. This also adds minimal reference support for locals, allowing go to definition and find references to work for locals.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
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 localsBlockSchema() *schema.BlockSchema { | ||
return &schema.BlockSchema{ | ||
SemanticTokenModifiers: lang.SemanticTokenModifiers{tokmod.Locals}, | ||
Description: lang.Markdown("Local values assigning names to expressions, so you can use these multiple times without repetition\n" + | ||
"e.g. `service_name = \"forum\"`"), | ||
Body: &schema.BodySchema{ | ||
AnyAttribute: &schema.AttributeSchema{ | ||
Address: &schema.AttributeAddrSchema{ | ||
Steps: []schema.AddrStep{ | ||
schema.StaticStep{Name: "local"}, | ||
schema.AttrNameStep{}, | ||
}, | ||
ScopeId: refscope.LocalScope, | ||
AsExprType: true, | ||
AsReference: true, | ||
}, | ||
Constraint: schema.AnyExpression{OfType: cty.DynamicPseudoType}, | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters