dependency

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DependencyTypeRemoteState = "remote_state"

DependencyTypeRemoteState marks a dependency derived from a terraform_remote_state data source. Reused by tests so the literal stays in one place.

Variables

This section is empty.

Functions

func BackendIndexKey

func BackendIndexKey(bc *model.BackendConfig, modulePath string) string

func ContainsDynamicPattern

func ContainsDynamicPattern(path string) bool

Types

type Dependency

type Dependency = model.Dependency

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(parser ModuleParser, index *discovery.ModuleIndex) *Engine

func (*Engine) ExtractAllDependencies

func (e *Engine) ExtractAllDependencies(ctx context.Context) (map[string]*ModuleDependencies, []error)

ExtractAllDependencies resolves dependencies for every module. Builds the backend-index up front because batch traversal will hit it for nearly every module anyway — eager construction lets the index parsing run concurrently with the first session's setup.

func (*Engine) ExtractDependencies

func (e *Engine) ExtractDependencies(ctx context.Context, module *discovery.Module) (*ModuleDependencies, error)

ExtractDependencies resolves dependencies for a single module.

Backend-index construction (which parses every other module in parallel to map state-keys to backends) is deferred until MatchBackend is actually called from the session. Single-module consumers whose state references always disambiguate by path alone don't pay the O(N) cost — they only see the index built lazily on first ambiguous lookup.

func (*Engine) MatchBackend

func (e *Engine) MatchBackend(ctx context.Context, backendType, bucket, statePath string) *discovery.Module

MatchBackend triggers lazy backend-index construction on first use. Single-module callers whose remote_state pointers all disambiguate by path alone never invoke this — and therefore never pay the O(N) parse cost.

ctx propagates cancellation into the parallel module-parse pass that the index uses on first build; subsequent calls reuse the cached index.

func (*Engine) MatchPathToModule

func (e *Engine) MatchPathToModule(statePath string, from *discovery.Module) *discovery.Module

type LibraryDependency

type LibraryDependency = model.LibraryDependency

type ModuleDependencies

type ModuleDependencies = model.ModuleDependencies

type ModuleParser

type ModuleParser interface {
	ParseModule(ctx context.Context, modulePath string) (*model.ParsedModule, error)
	ResolveWorkspacePath(ref *model.RemoteStateRef, modulePath string, locals, variables map[string]cty.Value) ([]string, error)
}

Jump to

Keyboard shortcuts

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