Documentation
¶
Index ¶
- Constants
- func BackendIndexKey(bc *model.BackendConfig, modulePath string) string
- func ContainsDynamicPattern(path string) bool
- type Dependency
- type Engine
- func (e *Engine) ExtractAllDependencies(ctx context.Context) (map[string]*ModuleDependencies, []error)
- func (e *Engine) ExtractDependencies(ctx context.Context, module *discovery.Module) (*ModuleDependencies, error)
- func (e *Engine) MatchBackend(ctx context.Context, backendType, bucket, statePath string) *discovery.Module
- func (e *Engine) MatchPathToModule(statePath string, from *discovery.Module) *discovery.Module
- type LibraryDependency
- type ModuleDependencies
- type ModuleParser
Constants ¶
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 ¶
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.
type LibraryDependency ¶
type LibraryDependency = model.LibraryDependency
type ModuleDependencies ¶
type ModuleDependencies = model.ModuleDependencies