discovery

package
v0.77.21 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package discovery provides functionality for discovering Terragrunt configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigType

type ConfigType string

ConfigType is the type of Terragrunt configuration.

const (
	// ConfigTypeUnit is the type of Terragrunt configuration for a unit.
	ConfigTypeUnit ConfigType = "unit"
	// ConfigTypeStack is the type of Terragrunt configuration for a stack.
	ConfigTypeStack ConfigType = "stack"
)

type DependencyDiscovery added in v0.75.7

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

DependencyDiscovery is the configuration for a DependencyDiscovery.

func NewDependencyDiscovery added in v0.75.7

func NewDependencyDiscovery(cfgs DiscoveredConfigs, depthRemaining int) *DependencyDiscovery

func (*DependencyDiscovery) DiscoverAllDependencies added in v0.75.7

func (d *DependencyDiscovery) DiscoverAllDependencies(ctx context.Context, opts *options.TerragruntOptions) error

func (*DependencyDiscovery) DiscoverDependencies added in v0.75.7

func (d *DependencyDiscovery) DiscoverDependencies(ctx context.Context, opts *options.TerragruntOptions, dCfg *DiscoveredConfig) error

func (*DependencyDiscovery) WithDiscoverExternalDependencies added in v0.77.3

func (d *DependencyDiscovery) WithDiscoverExternalDependencies() *DependencyDiscovery

WithDiscoverExternalDependencies sets the DiscoverExternalDependencies flag to true.

func (*DependencyDiscovery) WithDiscoveryContext added in v0.77.14

func (d *DependencyDiscovery) WithDiscoveryContext(discoveryContext *DiscoveryContext) *DependencyDiscovery

func (*DependencyDiscovery) WithSuppressParseErrors added in v0.77.3

func (d *DependencyDiscovery) WithSuppressParseErrors() *DependencyDiscovery

WithSuppressParseErrors sets the SuppressParseErrors flag to true.

type DependencyDiscoveryOption added in v0.77.3

type DependencyDiscoveryOption func(*DependencyDiscovery)

DependencyDiscoveryOption is a function that modifies a DependencyDiscovery.

type DiscoveredConfig

type DiscoveredConfig struct {
	Parsed           *config.TerragruntConfig
	DiscoveryContext *DiscoveryContext

	Type ConfigType
	Path string

	Dependencies DiscoveredConfigs

	External bool
}

DiscoveredConfig represents a discovered Terragrunt configuration.

func (*DiscoveredConfig) ContainsDependencyInAncestry added in v0.75.7

func (c *DiscoveredConfig) ContainsDependencyInAncestry(path string) bool

ContainsDependencyInAncestry returns true if the DiscoveredConfig or any of its dependencies contains the given path as a dependency.

func (*DiscoveredConfig) Parse added in v0.77.14

func (c *DiscoveredConfig) Parse(ctx context.Context, opts *options.TerragruntOptions, suppressParseErrors bool) error

Parse parses the discovered configurations.

func (*DiscoveredConfig) String

func (c *DiscoveredConfig) String() string

String returns a string representation of a DiscoveredConfig.

type DiscoveredConfigs

type DiscoveredConfigs []*DiscoveredConfig

DiscoveredConfigs is a list of discovered Terragrunt configurations.

func (DiscoveredConfigs) CycleCheck added in v0.75.7

func (c DiscoveredConfigs) CycleCheck() (*DiscoveredConfig, error)

CycleCheck checks for cycles in the dependency graph. If a cycle is detected, it returns the first DiscoveredConfig that is part of the cycle, and an error. If no cycle is detected, it returns nil and nil.

func (DiscoveredConfigs) Filter

func (c DiscoveredConfigs) Filter(configType ConfigType) DiscoveredConfigs

Filter filters the DiscoveredConfigs by config type.

func (DiscoveredConfigs) FilterByPath

func (c DiscoveredConfigs) FilterByPath(path string) DiscoveredConfigs

FilterByPath filters the DiscoveredConfigs by path.

func (DiscoveredConfigs) Paths

func (c DiscoveredConfigs) Paths() []string

Paths returns the paths of the DiscoveredConfigs.

func (DiscoveredConfigs) RemoveByPath added in v0.77.3

func (c DiscoveredConfigs) RemoveByPath(path string) DiscoveredConfigs

RemoveByPath removes the DiscoveredConfig with the given path from the DiscoveredConfigs.

func (DiscoveredConfigs) RemoveCycles added in v0.77.3

func (c DiscoveredConfigs) RemoveCycles() (DiscoveredConfigs, error)

RemoveCycles removes cycles from the dependency graph.

func (DiscoveredConfigs) Sort

Sort sorts the DiscoveredConfigs by path.

type Discovery

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

Discovery is the configuration for a Terragrunt discovery.

func NewDiscovery

func NewDiscovery(dir string, opts ...DiscoveryOption) *Discovery

NewDiscovery creates a new Discovery.

func (*Discovery) Discover

Discover discovers Terragrunt configurations in the WorkingDir.

func (*Discovery) WithDiscoverDependencies added in v0.75.7

func (d *Discovery) WithDiscoverDependencies() *Discovery

WithDiscoverDependencies sets the DiscoverDependencies flag to true.

func (*Discovery) WithDiscoverExternalDependencies added in v0.75.7

func (d *Discovery) WithDiscoverExternalDependencies() *Discovery

WithDiscoverExternalDependencies sets the DiscoverExternalDependencies flag to true.

func (*Discovery) WithDiscoveryContext added in v0.77.14

func (d *Discovery) WithDiscoveryContext(discoveryContext *DiscoveryContext) *Discovery

WithDiscoveryContext sets the DiscoveryContext flag to the given context.

func (*Discovery) WithHidden

func (d *Discovery) WithHidden() *Discovery

WithHidden sets the Hidden flag to true.

func (*Discovery) WithMaxDependencyDepth added in v0.75.7

func (d *Discovery) WithMaxDependencyDepth(depth int) *Discovery

WithMaxDependencyDepth sets the MaxDependencyDepth flag to the given depth.

func (*Discovery) WithParseExclude added in v0.77.14

func (d *Discovery) WithParseExclude() *Discovery

WithParseExclude sets the ParseExclude flag to true.

func (*Discovery) WithSort added in v0.75.7

func (d *Discovery) WithSort(sort Sort) *Discovery

WithSort sets the Sort flag to the given sort.

func (*Discovery) WithSuppressParseErrors added in v0.77.3

func (d *Discovery) WithSuppressParseErrors() *Discovery

WithSuppressParseErrors sets the SuppressParseErrors flag to true.

type DiscoveryContext added in v0.77.14

type DiscoveryContext struct {
	Cmd  string
	Args []string
}

DiscoveryContext is the context in which a DiscoveredConfig was discovered.

It's useful to know this information, because it can help us determine how the DiscoveredConfig should be processed later.

type DiscoveryOption

type DiscoveryOption func(*Discovery)

DiscoveryOption is a function that modifies a Discovery.

type Sort added in v0.75.7

type Sort string

Sort is the sort order of the discovered configurations.

Jump to

Keyboard shortcuts

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