jobs

package
v0.36.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

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

func LoadStackMetadata(ctx context.Context, stackStore *state.StackStore, stackPath string) error

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

Types

type ReadOnlyFS

type ReadOnlyFS interface {
	fs.FS
	ReadDir(name string) ([]fs.DirEntry, error)
	ReadFile(name string) ([]byte, error)
	Stat(name string) (fs.FileInfo, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL