Documentation ¶
Index ¶
- func DecodeReferenceOrigins(ctx context.Context, stackStore *state.StackStore, ...) error
- func DecodeReferenceTargets(ctx context.Context, stackStore *state.StackStore, ...) error
- func LoadStackMetadata(ctx context.Context, stackStore *state.StackStore, stackPath string) error
- func LoadTerraformVersion(ctx context.Context, fs ReadOnlyFS, stackStore *state.StackStore, ...) error
- func ParseStackConfiguration(ctx context.Context, fs ReadOnlyFS, stackStore *state.StackStore, ...) error
- func PreloadEmbeddedSchema(ctx context.Context, logger *log.Logger, fs fs.ReadDirFS, ...) error
- func ReferenceValidation(ctx context.Context, stackStore *state.StackStore, ...) error
- func SchemaStackValidation(ctx context.Context, stackStore *state.StackStore, ...) error
- type ReadOnlyFS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeReferenceOrigins ¶ added in v0.35.0
func DecodeReferenceOrigins(ctx context.Context, stackStore *state.StackStore, moduleReader sdecoder.ModuleReader, rootReader sdecoder.RootReader, stackPath string) error
DecodeReferenceOrigins collects reference origins, using previously parsed AST (via ParseStackConfiguration), core schema of appropriate version (as obtained via [GetTerraformVersion]) and provider schemas (PreloadEmbeddedSchema or [ObtainSchema]).
For example it tells us that there is a reference address var.foobar at a particular LOC. This can be later matched with targets (as obtained via DecodeReferenceTargets) during hover or go-to-definition.
func DecodeReferenceTargets ¶ added in v0.35.0
func DecodeReferenceTargets(ctx context.Context, stackStore *state.StackStore, moduleReader sdecoder.ModuleReader, rootReader sdecoder.RootReader, stackPath string) error
DecodeReferenceTargets collects reference targets, using previously parsed AST (via ParseStackConfiguration), core schema of appropriate version (as obtained via [GetTerraformVersion]) and provider schemas (PreloadEmbeddedSchema or [ObtainSchema]).
For example it tells us that variable block between certain LOC can be referred to as var.foobar. This is useful e.g. during completion, go-to-definition or go-to-references.
func LoadStackMetadata ¶ added in v0.35.0
LoadStackMetadata loads data about the stack in a version-independent way that enables us to decode the rest of the configuration, e.g. by knowing provider versions, etc.
func LoadTerraformVersion ¶
func LoadTerraformVersion(ctx context.Context, fs ReadOnlyFS, stackStore *state.StackStore, stackPath string) error
LoadTerraformVersion loads the terraform version from the .terraform-version file in the stack directory.
func ParseStackConfiguration ¶
func ParseStackConfiguration(ctx context.Context, fs ReadOnlyFS, stackStore *state.StackStore, stackPath string) error
ParseStackConfiguration parses the whole Stack configuration, i.e. turns bytes of `*.tfstack.hcl` & `*.tfdeploy.hcl` files into AST (*hcl.File).
func PreloadEmbeddedSchema ¶ added in v0.35.0
func PreloadEmbeddedSchema(ctx context.Context, logger *log.Logger, fs fs.ReadDirFS, stackStore *state.StackStore, schemaStore *globalState.ProviderSchemaStore, stackPath string) error
func ReferenceValidation ¶ added in v0.35.0
func ReferenceValidation(ctx context.Context, stackStore *state.StackStore, moduleFeature stackDecoder.ModuleReader, rootFeature stackDecoder.RootReader, stackPath string) error
ReferenceValidation does validation based on (mis)matched reference origins and targets, to flag up "orphaned" references.
It relies on DecodeReferenceTargets and DecodeReferenceOrigins to supply both origins and targets to compare.
func SchemaStackValidation ¶ added in v0.35.0
func SchemaStackValidation(ctx context.Context, stackStore *state.StackStore, moduleFeature stackDecoder.ModuleReader, rootFeature stackDecoder.RootReader, stackPath string) error