exec

package
v1.172.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: Apache-2.0 Imports: 78 Imported by: 0

Documentation

Index

Constants

View Source
const ErrWrappingFormat = "%w: %w"
View Source
const MaxShellDepth = 10

MaxShellDepth is the maximum number of nested shell commands that can be executed

Variables

View Source
var (
	ErrDownloadPackage                       = errors.New("failed to download package")
	ErrProcessOCIImage                       = errors.New("failed to process OCI image")
	ErrCopyPackage                           = errors.New("failed to copy package")
	ErrCreateTempDir                         = errors.New("failed to create temp directory")
	ErrUnknownPackageType                    = errors.New("unknown package type")
	ErrLocalMixinURICannotBeEmpty            = errors.New("local mixin URI cannot be empty")
	ErrLocalMixinInstallationNotImplemented  = errors.New("local mixin installation not implemented")
	ErrFailedToInitializeTUIModel            = errors.New("failed to initialize TUI model: verify terminal capabilities and permissions")
	ErrSetTempDirPermissions                 = errors.New("failed to set temp directory permissions")
	ErrCopyPackageToTarget                   = errors.New("failed to copy package to target")
	ErrNoValidInstallerPackage               = errors.New("no valid installer package provided")
	ErrFailedToInitializeTUIModelWithDetails = errors.New("failed to initialize TUI model: verify terminal capabilities and permissions")
	ErrValidPackage                          = errors.New("no valid installer package provided for")
	ErrTUIModel                              = errors.New("failed to initialize TUI model")
	ErrInvalidTemplateFunc                   = errors.New("invalid template function")
)
View Source
var (
	// Error constants.
	ErrInvalidHooksSection          = errors.New("invalid 'hooks' section in the file")
	ErrInvalidTerraformHooksSection = errors.New("invalid 'terraform.hooks' section in the file")
)
View Source
var (
	ErrInvalidFormat                      = errors.New("invalid format")
	ErrCreatingTempDirectory              = errors.New("error creating temporary directory")
	ErrCreatingIntermediateSubdirectories = errors.New("error creating intermediate subdirectories")
	ErrGettingJsonForPlanfile             = errors.New("error getting JSON for planfile")
	ErrConvertingJsonToGoType             = errors.New("error converting JSON to Go type")
	ErrNoComponent                        = errors.New("no component specified")
)
View Source
var (
	ErrExecuteVendorDiffCmd       = errors.New("'atmos vendor diff' is not implemented yet")
	ErrValidateComponentFlag      = errors.New("either '--component' or '--tags' flag can be provided, but not both")
	ErrValidateComponentStackFlag = errors.New("either '--component' or '--stack' flag can be provided, but not both")
	ErrValidateEverythingFlag     = errors.New("'--everything' flag cannot be combined with '--component', '--stack', or '--tags' flags")
	ErrMissingComponent           = errors.New("to vendor a component, the '--component' (shorthand '-c') flag needs to be specified.\n" +
		"Example: atmos vendor pull -c <component>")
)
View Source
var (
	ErrMissingMixinURI             = errors.New("'uri' must be specified for each 'mixin' in the 'component.yaml' file")
	ErrMissingMixinFilename        = errors.New("'filename' must be specified for each 'mixin' in the 'component.yaml' file")
	ErrUnsupportedComponentType    = errors.New("'%s' is not supported type. Valid types are 'terraform' and 'helmfile'")
	ErrMixinEmpty                  = errors.New("mixin URI cannot be empty")
	ErrMixinNotImplemented         = errors.New("local mixin installation not implemented")
	ErrStackPullNotSupported       = errors.New("command 'atmos vendor pull --stack <stack>' is not supported yet")
	ErrComponentConfigFileNotFound = errors.New("component vendoring config file does not exist in the folder")
	ErrFolderNotFound              = errors.New("folder does not exist")
	ErrInvalidComponentKind        = errors.New("invalid 'kind' in the component vendoring config file. Supported kinds: 'ComponentVendorConfig'")
	ErrUriMustSpecified            = errors.New("'uri' must be specified in 'source.uri' in the component vendoring config file")
)
View Source
var (
	ErrVendorComponents              = errors.New("failed to vendor components")
	ErrSourceMissing                 = errors.New("'source' must be specified in 'sources' in the vendor config file")
	ErrTargetsMissing                = errors.New("'targets' must be specified for the source in the vendor config file")
	ErrVendorConfigSelfImport        = errors.New("vendor config file imports itself in 'spec.imports'")
	ErrMissingVendorConfigDefinition = errors.New("either 'spec.sources' or 'spec.imports' (or both) must be defined in the vendor config file")
	ErrVendoringNotConfigured        = errors.New("Vendoring is not configured. To set up vendoring, please see https://atmos.tools/core-concepts/vendor/")
	ErrPermissionDenied              = errors.New("Permission denied when accessing")
	ErrEmptySources                  = errors.New("'spec.sources' is empty in the vendor config file and the imports")
	ErrNoComponentsWithTags          = errors.New("there are no components in the vendor config file")
	ErrNoYAMLConfigFiles             = errors.New("no YAML configuration files found in directory")
	ErrDuplicateComponents           = errors.New("duplicate component names")
	ErrDuplicateImport               = errors.New("Duplicate import")
	ErrDuplicateComponentsFound      = errors.New("duplicate component")
	ErrComponentNotDefined           = errors.New("the flag '--component' is passed, but the component is not defined in any of the 'sources' in the vendor config file and the imports")
)
View Source
var ErrHTTPBackendWorkspaces = errors.New("workspaces are not supported for the HTTP backend")

ErrHTTPBackendWorkspaces is returned when attempting to use workspace commands with an HTTP backend.

View Source
var ErrInvalidFilePath = errors.New("invalid file path")
View Source
var (
	// ErrNoJSONOutput is returned when no JSON output is found in terraform show output.
	ErrNoJSONOutput = errors.New("no JSON output found in terraform show output")
)

Static errors.

View Source
var ErrNoLayers = errors.New("the OCI image does not have any layers")
View Source
var StderrLogger = log.New(os.Stderr)

Dedicated logger for stderr to keep stdout clean of detailed messaging, e.g. for files vendoring.

Functions

func BuildAtlantisProjectNameFromComponentConfig added in v1.31.0

func BuildAtlantisProjectNameFromComponentConfig(
	atmosConfig schema.AtmosConfiguration,
	configAndStacksInfo schema.ConfigAndStacksInfo,
) (string, error)

BuildAtlantisProjectNameFromComponentConfig builds an Atlantis project name from the component config

func BuildComponentPath added in v1.31.0

func BuildComponentPath(
	atmosConfig schema.AtmosConfiguration,
	componentSectionMap map[string]any,
	componentType string,
) string

BuildComponentPath builds component path (path to the component's physical location on disk)

func BuildDependentStackNameFromDependsOn added in v1.33.2

func BuildDependentStackNameFromDependsOn(
	currentComponentName string,
	currentStackName string,
	dependsOnComponentName string,
	dependsOnStackName string,
	allStackNames []string,
) (string, error)

BuildDependentStackNameFromDependsOn builds the dependent stack name from "settings.depends_on" config

func BuildDependentStackNameFromDependsOnLegacy added in v1.50.0

func BuildDependentStackNameFromDependsOnLegacy(
	dependsOn string,
	allStackNames []string,
	currentStackName string,
	componentNamesInCurrentStack []string,
	currentComponentName string,
) (string, error)

BuildDependentStackNameFromDependsOnLegacy builds the dependent stack name from "settings.spacelift.depends_on" config

func BuildSpaceliftStackName added in v1.24.0

func BuildSpaceliftStackName(spaceliftSettings map[string]any, context schema.Context, contextPrefix string) (string, string, error)

BuildSpaceliftStackName builds a Spacelift stack name from the provided context and stack name pattern

func BuildSpaceliftStackNameFromComponentConfig added in v1.31.0

func BuildSpaceliftStackNameFromComponentConfig(
	atmosConfig schema.AtmosConfiguration,
	configAndStacksInfo schema.ConfigAndStacksInfo,
) (string, error)

BuildSpaceliftStackNameFromComponentConfig builds Spacelift stack name from the component config

func BuildSpaceliftStackNames added in v1.31.0

func BuildSpaceliftStackNames(stacks map[string]any, stackNamePattern string) ([]string, error)

BuildSpaceliftStackNames builds Spacelift stack names

func BuildTerraformWorkspace added in v1.4.8

func BuildTerraformWorkspace(atmosConfig schema.AtmosConfiguration, configAndStacksInfo schema.ConfigAndStacksInfo) (string, error)

BuildTerraformWorkspace builds Terraform workspace

func ComponentOrMixinsCopy added in v1.168.0

func ComponentOrMixinsCopy(sourceFile, finalTarget string) error

ComponentOrMixinsCopy covers 2 cases: file-to-folder and file-to-file copy.

func CreateComponentStackMap added in v1.81.0

func CreateComponentStackMap(
	atmosConfig schema.AtmosConfiguration,
	stacksBasePath string,
	terraformComponentsBasePath string,
	helmfileComponentsBasePath string,
	filePath string,
) (map[string]map[string][]string, error)

CreateComponentStackMap accepts a config file and creates a map of component-stack dependencies

func DeletePathTerraform added in v1.114.0

func DeletePathTerraform(fullPath string, objectName string) error

DeletePathTerraform deletes the specified file or folder. with a checkmark or xmark

func ExecuteAtlantisGenerateRepoConfig added in v1.5.0

func ExecuteAtlantisGenerateRepoConfig(
	atmosConfig schema.AtmosConfiguration,
	outputPath string,
	configTemplateNameArg string,
	projectTemplateNameArg string,
	stacks []string,
	components []string,
) error

ExecuteAtlantisGenerateRepoConfig generates repository configuration for Atlantis

func ExecuteAtlantisGenerateRepoConfigAffectedOnly added in v1.30.0

func ExecuteAtlantisGenerateRepoConfigAffectedOnly(
	atmosConfig schema.AtmosConfiguration,
	outputPath string,
	configTemplateName string,
	projectTemplateName string,
	ref string,
	sha string,
	repoPath string,
	sshKeyPath string,
	sshKeyPassword string,
	verbose bool,
	cloneTargetRef bool,
	stack string,
) error

ExecuteAtlantisGenerateRepoConfigAffectedOnly generates repository configuration for Atlantis only for the affected components and stacks

func ExecuteAtlantisGenerateRepoConfigCmd added in v1.5.0

func ExecuteAtlantisGenerateRepoConfigCmd(cmd *cobra.Command, args []string) error

ExecuteAtlantisGenerateRepoConfigCmd executes 'atlantis generate repo-config' command

func ExecuteAtmosCmd added in v1.54.0

func ExecuteAtmosCmd() error

ExecuteAtmosCmd executes `atmos` command

func ExecuteAtmosVendorInternal added in v1.47.0

func ExecuteAtmosVendorInternal(params *executeVendorOptions) error

ExecuteAtmosVendorInternal downloads the artifacts from the sources and writes them to the targets.

func ExecuteAwsEksUpdateKubeconfig added in v1.4.9

func ExecuteAwsEksUpdateKubeconfig(kubeconfigContext schema.AwsEksUpdateKubeconfigContext) error

ExecuteAwsEksUpdateKubeconfig executes 'aws eks update-kubeconfig' https://docs.aws.amazon.com/cli/latest/reference/eks/update-kubeconfig.html

func ExecuteAwsEksUpdateKubeconfigCommand added in v1.4.9

func ExecuteAwsEksUpdateKubeconfigCommand(cmd *cobra.Command, args []string) error

func ExecuteComponentVendorInternal added in v1.47.0

func ExecuteComponentVendorInternal(
	atmosConfig *schema.AtmosConfiguration,
	vendorComponentSpec *schema.VendorComponentSpec,
	component string,
	componentPath string,
	dryRun bool,
) error

func ExecuteDescribeAffectedCmd added in v1.17.0

func ExecuteDescribeAffectedCmd(cmd *cobra.Command, args []string) error

ExecuteDescribeAffectedCmd executes `describe affected` command

func ExecuteDescribeAffectedWithTargetRefCheckout added in v1.71.0

func ExecuteDescribeAffectedWithTargetRefCheckout(
	atmosConfig schema.AtmosConfiguration,
	ref string,
	sha string,
	verbose bool,
	includeSpaceliftAdminStacks bool,
	includeSettings bool,
	stack string,
	processTemplates bool,
	processYamlFunctions bool,
	skip []string,
) ([]schema.Affected, *plumbing.Reference, *plumbing.Reference, string, error)

ExecuteDescribeAffectedWithTargetRefCheckout checks out the target reference, processes stack configs, and returns a list of the affected Atmos components and stacks given two Git commits

func ExecuteDescribeAffectedWithTargetRefClone added in v1.71.0

func ExecuteDescribeAffectedWithTargetRefClone(
	atmosConfig schema.AtmosConfiguration,
	ref string,
	sha string,
	sshKeyPath string,
	sshKeyPassword string,
	verbose bool,
	includeSpaceliftAdminStacks bool,
	includeSettings bool,
	stack string,
	processTemplates bool,
	processYamlFunctions bool,
	skip []string,
) ([]schema.Affected, *plumbing.Reference, *plumbing.Reference, string, error)

ExecuteDescribeAffectedWithTargetRefClone clones the remote reference, processes stack configs, and returns a list of the affected Atmos components and stacks given two Git commits

func ExecuteDescribeAffectedWithTargetRepoPath added in v1.26.0

func ExecuteDescribeAffectedWithTargetRepoPath(
	atmosConfig schema.AtmosConfiguration,
	targetRefPath string,
	verbose bool,
	includeSpaceliftAdminStacks bool,
	includeSettings bool,
	stack string,
	processTemplates bool,
	processYamlFunctions bool,
	skip []string,
) ([]schema.Affected, *plumbing.Reference, *plumbing.Reference, string, error)

ExecuteDescribeAffectedWithTargetRepoPath uses `repo-path` to access the target repo, and processes stack configs and returns a list of the affected Atmos components and stacks given two Git commits

func ExecuteDescribeComponent

func ExecuteDescribeComponent(
	component string,
	stack string,
	processTemplates bool,
	processYamlFunctions bool,
	skip []string,
) (map[string]any, error)

ExecuteDescribeComponent describes component config

func ExecuteDescribeComponentCmd added in v1.11.0

func ExecuteDescribeComponentCmd(cmd *cobra.Command, args []string) error

ExecuteDescribeComponentCmd executes `describe component` command

func ExecuteDescribeConfigCmd added in v1.11.0

func ExecuteDescribeConfigCmd(cmd *cobra.Command, args []string) error

ExecuteDescribeConfigCmd executes `describe config` command

func ExecuteDescribeDependents added in v1.33.2

func ExecuteDescribeDependents(
	atmosConfig schema.AtmosConfiguration,
	component string,
	stack string,
	includeSettings bool,
) ([]schema.Dependent, error)

ExecuteDescribeDependents produces a list of Atmos components in Atmos stacks that depend on the provided Atmos component

func ExecuteDescribeDependentsCmd added in v1.33.2

func ExecuteDescribeDependentsCmd(cmd *cobra.Command, args []string) error

ExecuteDescribeDependentsCmd executes `describe dependents` command

func ExecuteDescribeStacks added in v1.4.4

func ExecuteDescribeStacks(
	atmosConfig schema.AtmosConfiguration,
	filterByStack string,
	components []string,
	componentTypes []string,
	sections []string,
	ignoreMissingFiles bool,
	processTemplates bool,
	processYamlFunctions bool,
	includeEmptyStacks bool,
	skip []string,
) (map[string]any, error)

ExecuteDescribeStacks processes stack manifests and returns the final map of stacks and components

func ExecuteDescribeStacksCmd added in v1.11.0

func ExecuteDescribeStacksCmd(cmd *cobra.Command, args []string) error

ExecuteDescribeStacksCmd executes `describe stacks` command

func ExecuteDescribeWorkflows added in v1.55.0

func ExecuteDescribeWorkflows(
	atmosConfig schema.AtmosConfiguration,
) ([]schema.DescribeWorkflowsItem, map[string][]string, map[string]schema.WorkflowManifest, error)

ExecuteDescribeWorkflows executes `atmos describe workflows` command

func ExecuteDescribeWorkflowsCmd added in v1.55.0

func ExecuteDescribeWorkflowsCmd(cmd *cobra.Command, args []string) error

ExecuteDescribeWorkflowsCmd executes `atmos describe workflows` CLI command

func ExecuteHelmfile

func ExecuteHelmfile(info schema.ConfigAndStacksInfo) error

ExecuteHelmfile executes helmfile commands

func ExecuteHelmfileCmd added in v1.11.0

func ExecuteHelmfileCmd(cmd *cobra.Command, args []string, additionalArgsAndFlags []string) error

ExecuteHelmfileCmd parses the provided arguments and flags and executes helmfile commands

func ExecuteHelmfileGenerateVarfileCmd added in v1.11.0

func ExecuteHelmfileGenerateVarfileCmd(cmd *cobra.Command, args []string) error

ExecuteHelmfileGenerateVarfileCmd executes `helmfile generate varfile` command

func ExecuteInstall added in v1.130.0

func ExecuteInstall(installer pkgVendor, dryRun bool, atmosConfig *schema.AtmosConfiguration) tea.Cmd

func ExecuteProLockCommand added in v1.87.0

func ExecuteProLockCommand(cmd *cobra.Command, args []string) error

ExecuteProLockCommand executes `atmos pro lock` command

func ExecuteProUnlockCommand added in v1.87.0

func ExecuteProUnlockCommand(cmd *cobra.Command, args []string) error

ExecuteProUnlockCommand executes `atmos pro unlock` command

func ExecuteShell added in v1.16.0

func ExecuteShell(
	atmosConfig schema.AtmosConfiguration,
	command string,
	name string,
	dir string,
	env []string,
	dryRun bool,
) error

ExecuteShell runs a shell script

func ExecuteShellAndReturnOutput added in v1.16.0

func ExecuteShellAndReturnOutput(
	atmosConfig schema.AtmosConfiguration,
	command string,
	name string,
	dir string,
	env []string,
	dryRun bool,
) (string, error)

ExecuteShellAndReturnOutput runs a shell script and capture its standard output

func ExecuteShellCommand added in v1.4.9

func ExecuteShellCommand(
	atmosConfig schema.AtmosConfiguration,
	command string,
	args []string,
	dir string,
	env []string,
	dryRun bool,
	redirectStdError string,
) error

ExecuteShellCommand prints and executes the provided command with args and flags

func ExecuteStackVendorInternal added in v1.47.0

func ExecuteStackVendorInternal(
	stack string,
	dryRun bool,
) error

ExecuteStackVendorInternal executes the command to vendor an Atmos stack. TODO: implement this.

func ExecuteTerraform

func ExecuteTerraform(info schema.ConfigAndStacksInfo) error

ExecuteTerraform executes terraform commands

func ExecuteTerraformCmd added in v1.11.0

func ExecuteTerraformCmd(cmd *cobra.Command, args []string, additionalArgsAndFlags []string) error

ExecuteTerraformCmd parses the provided arguments and flags and executes terraform commands

func ExecuteTerraformGenerateBackendCmd added in v1.11.0

func ExecuteTerraformGenerateBackendCmd(cmd *cobra.Command, args []string) error

ExecuteTerraformGenerateBackendCmd executes `terraform generate backend` command

func ExecuteTerraformGenerateBackends

func ExecuteTerraformGenerateBackends(
	atmosConfig schema.AtmosConfiguration,
	fileTemplate string,
	format string,
	stacks []string,
	components []string,
) error

ExecuteTerraformGenerateBackends generates backend configs for all terraform components

func ExecuteTerraformGenerateBackendsCmd added in v1.7.0

func ExecuteTerraformGenerateBackendsCmd(cmd *cobra.Command, args []string) error

ExecuteTerraformGenerateBackendsCmd executes `terraform generate backends` command

func ExecuteTerraformGeneratePlanfile added in v1.172.0

func ExecuteTerraformGeneratePlanfile(
	options *PlanfileOptions,
	info *schema.ConfigAndStacksInfo,
) error

ExecuteTerraformGeneratePlanfile executes `terraform generate planfile`.

func ExecuteTerraformGeneratePlanfileCmd added in v1.172.0

func ExecuteTerraformGeneratePlanfileCmd(cmd *cobra.Command, args []string) error

ExecuteTerraformGeneratePlanfileCmd executes `terraform generate planfile` command.

func ExecuteTerraformGenerateVarfileCmd added in v1.11.0

func ExecuteTerraformGenerateVarfileCmd(cmd *cobra.Command, args []string) error

ExecuteTerraformGenerateVarfileCmd executes `terraform generate varfile` command

func ExecuteTerraformGenerateVarfiles added in v1.5.0

func ExecuteTerraformGenerateVarfiles(
	atmosConfig schema.AtmosConfiguration,
	fileTemplate string,
	format string,
	stacks []string,
	components []string,
) error

ExecuteTerraformGenerateVarfiles generates varfiles for all terraform components in all stacks

func ExecuteTerraformGenerateVarfilesCmd added in v1.5.0

func ExecuteTerraformGenerateVarfilesCmd(cmd *cobra.Command, args []string) error

ExecuteTerraformGenerateVarfilesCmd executes `terraform generate varfiles` command

func ExecuteValidateComponent added in v1.9.0

func ExecuteValidateComponent(
	atmosConfig schema.AtmosConfiguration,
	configAndStacksInfo schema.ConfigAndStacksInfo,
	componentName string,
	stack string,
	schemaPath string,
	schemaType string,
	modulePaths []string,
	timeoutSeconds int,
) (bool, error)

ExecuteValidateComponent validates a component in a stack using JsonSchema, OPA or CUE schema documents

func ExecuteValidateComponentCmd added in v1.9.0

func ExecuteValidateComponentCmd(cmd *cobra.Command, args []string) (string, string, error)

ExecuteValidateComponentCmd executes `validate component` command

func ExecuteValidateStacksCmd added in v1.11.0

func ExecuteValidateStacksCmd(cmd *cobra.Command, args []string) error

ExecuteValidateStacksCmd executes `validate stacks` command

func ExecuteVendorDiffCmd added in v1.11.0

func ExecuteVendorDiffCmd(cmd *cobra.Command, args []string) error

ExecuteVendorDiffCmd executes `vendor diff` commands.

func ExecuteVendorPullCmd added in v1.11.0

func ExecuteVendorPullCmd(cmd *cobra.Command, args []string) error

ExecuteVendorPullCmd executes `vendor pull` commands.

func ExecuteVendorPullCommand added in v1.47.0

func ExecuteVendorPullCommand(cmd *cobra.Command, args []string) error

ExecuteVendorPullCommand executes `atmos vendor` commands.

func ExecuteWorkflow added in v1.4.0

func ExecuteWorkflow(
	atmosConfig schema.AtmosConfiguration,
	workflow string,
	workflowPath string,
	workflowDefinition *schema.WorkflowDefinition,
	dryRun bool,
	commandLineStack string,
	fromStep string,
) error

ExecuteWorkflow executes an Atmos workflow

func ExecuteWorkflowCmd added in v1.11.0

func ExecuteWorkflowCmd(cmd *cobra.Command, args []string) error

ExecuteWorkflowCmd executes an Atmos workflow

func ExecuteWorkflowUI added in v1.81.0

func ExecuteWorkflowUI(atmosConfig schema.AtmosConfiguration) (string, string, string, error)

func FilterAbstractComponents added in v1.125.0

func FilterAbstractComponents(componentsMap map[string]any) []string

FilterAbstractComponents This function removes abstract components and returns the list of components

func FindComponentDependencies added in v1.42.0

func FindComponentDependencies(currentStack string, sources schema.ConfigSources) ([]string, []string, error)

FindComponentDependencies finds all imports that the component depends on, and all imports that the component has any sections defined in

func FindComponentDependenciesLegacy added in v1.81.0

func FindComponentDependenciesLegacy(
	stack string,
	componentType string,
	component string,
	baseComponents []string,
	stackImports map[string]map[string]any,
) ([]string, error)

FindComponentDependenciesLegacy finds all imports where the component or the base component(s) are defined Component depends on the imported config file if any of the following conditions is true:

  1. The imported config file has any of the global `backend`, `backend_type`, `env`, `remote_state_backend`, `remote_state_backend_type`, `settings` or `vars` sections which are not empty.
  2. The imported config file has the component type section, which has any of the `backend`, `backend_type`, `env`, `remote_state_backend`, `remote_state_backend_type`, `settings` or `vars` sections which are not empty.
  3. The imported config file has the "components" section, which has the component type section, which has the component section.
  4. The imported config file has the "components" section, which has the component type section, which has the base component(s) section, and the base component section is defined inline (not imported).

func FindComponentStacks added in v1.81.0

func FindComponentStacks(
	componentType string,
	component string,
	baseComponent string,
	componentStackMap map[string]map[string][]string,
) ([]string, error)

FindComponentStacks finds all infrastructure stack manifests where the component or the base component is defined

func FindComponentsDerivedFromBaseComponents added in v1.81.0

func FindComponentsDerivedFromBaseComponents(
	stack string,
	allComponents map[string]any,
	baseComponents []string,
) ([]string, error)

FindComponentsDerivedFromBaseComponents finds all components that derive from the given base components

func FindStacksMap added in v1.4.4

func FindStacksMap(atmosConfig schema.AtmosConfiguration, ignoreMissingFiles bool) (
	map[string]any,
	map[string]map[string]any,
	error,
)

FindStacksMap processes stack config and returns a map of all stacks

func FindValidationSection added in v1.9.0

func FindValidationSection(componentSection map[string]any) (schema.Validation, error)

FindValidationSection finds 'validation' section in the component config

func FuncMap added in v1.81.0

func FuncMap(
	atmosConfig *schema.AtmosConfiguration,
	configAndStacksInfo *schema.ConfigAndStacksInfo,
	ctx context.Context,
	gomplateData *data.Data,
) template.FuncMap

FuncMap creates and returns a map of template functions

func GetComponentRemoteStateBackendStaticType added in v1.129.0

func GetComponentRemoteStateBackendStaticType(
	sections map[string]any,
) (map[string]any, error)

GetComponentRemoteStateBackendStaticType returns the `remote_state_backend` section for a component in a stack if the `remote_state_backend_type` is `static`

func GetFileContent added in v1.81.0

func GetFileContent(filePath string) (string, error)

GetFileContent tries to read and return the file content from the sync map if it exists in the map, otherwise it reads the file, stores its content in the map and returns the content

func GetStackNamePattern added in v1.66.0

func GetStackNamePattern(atmosConfig schema.AtmosConfiguration) string

GetStackNamePattern returns stack name pattern

func GetTerraformOutput added in v1.140.0

func GetTerraformOutput(
	atmosConfig *schema.AtmosConfiguration,
	stack string,
	component string,
	output string,
	skipCache bool,
) any

func IsComponentAbstract added in v1.78.0

func IsComponentAbstract(metadataSection map[string]any) bool

IsComponentAbstract returns 'true' if the component is abstract

func IsComponentEnabled added in v1.89.0

func IsComponentEnabled(varsSection map[string]any) bool

IsComponentEnabled returns 'true' if the component is enabled

func IsGolangTemplate added in v1.81.0

func IsGolangTemplate(str string) (bool, error)

IsGolangTemplate checks if the provided string is a Go template

func IsValidDataDir added in v1.114.0

func IsValidDataDir(tfDataDir string) error

func NewSpinner added in v1.160.3

func NewSpinner(message string) *tea.Program

NewSpinner initializes a spinner and returns a pointer to a tea.Program

func NewVersionExec added in v1.165.2

func NewVersionExec() *versionExec

func ProcessBaseComponentConfig added in v1.81.0

func ProcessBaseComponentConfig(
	atmosConfig schema.AtmosConfiguration,
	baseComponentConfig *schema.BaseComponentConfig,
	allComponentsMap map[string]any,
	component string,
	stack string,
	baseComponent string,
	componentBasePath string,
	checkBaseComponentExists bool,
	baseComponents *[]string,
) error

ProcessBaseComponentConfig processes base component(s) config

func ProcessCommandLineArgs added in v1.119.0

func ProcessCommandLineArgs(
	componentType string,
	cmd *cobra.Command,
	args []string,
	additionalArgsAndFlags []string,
) (schema.ConfigAndStacksInfo, error)

ProcessCommandLineArgs processes command-line args

func ProcessComponentConfig added in v1.66.0

func ProcessComponentConfig(
	configAndStacksInfo *schema.ConfigAndStacksInfo,
	stack string,
	stacksMap map[string]any,
	componentType string,
	component string,
) error

ProcessComponentConfig processes component config sections

func ProcessComponentMetadata added in v1.8.0

func ProcessComponentMetadata(
	component string,
	componentSection map[string]any,
) (map[string]any, string, bool, bool, bool)

ProcessComponentMetadata processes component metadata and returns a base component (if any) and whether the component is real or abstract and whether the component is disabled or not and whether the component is locked

func ProcessConfigSources added in v1.42.0

func ProcessConfigSources(
	configAndStacksInfo schema.ConfigAndStacksInfo,
	rawStackConfigs map[string]map[string]any,
) (schema.ConfigSources, error)

ProcessConfigSources processes the sources (files) for all sections for a component in a stack

func ProcessCustomYamlTags added in v1.111.0

func ProcessCustomYamlTags(
	atmosConfig schema.AtmosConfiguration,
	input schema.AtmosSectionMapType,
	currentStack string,
	skip []string,
) (schema.AtmosSectionMapType, error)

func ProcessImportSection added in v1.81.0

func ProcessImportSection(stackMap map[string]any, filePath string) ([]schema.StackImport, error)

ProcessImportSection processes the `import` section in stack manifests The `import` section can contain: 1. Project-relative paths (e.g. "mixins/region/us-east-2") 2. Paths relative to the current stack file (e.g. "./_defaults") 3. StackImport structs containing either of the above path types (e.g. "path: mixins/region/us-east-2")

func ProcessStackConfig added in v1.81.0

func ProcessStackConfig(
	atmosConfig schema.AtmosConfiguration,
	stacksBasePath string,
	terraformComponentsBasePath string,
	helmfileComponentsBasePath string,
	stack string,
	config map[string]any,
	processStackDeps bool,
	processComponentDeps bool,
	componentTypeFilter string,
	componentStackMap map[string]map[string][]string,
	importsConfig map[string]map[string]any,
	checkBaseComponentExists bool,
) (map[string]any, error)

ProcessStackConfig takes a stack manifest, deep-merges all variables, settings, environments and backends, and returns the final stack configuration for all Terraform and helmfile components.

func ProcessStacks added in v1.3.28

func ProcessStacks(
	atmosConfig schema.AtmosConfiguration,
	configAndStacksInfo schema.ConfigAndStacksInfo,
	checkStack bool,
	processTemplates bool,
	processYamlFunctions bool,
	skip []string,
) (schema.ConfigAndStacksInfo, error)

ProcessStacks processes stack config

func ProcessTmpl added in v1.81.0

func ProcessTmpl(
	tmplName string,
	tmplValue string,
	tmplData any,
	ignoreMissingTemplateValues bool,
) (string, error)

ProcessTmpl parses and executes Go templates

func ProcessTmplWithDatasources added in v1.81.0

func ProcessTmplWithDatasources(
	atmosConfig *schema.AtmosConfiguration,
	configAndStacksInfo *schema.ConfigAndStacksInfo,
	settingsSection schema.Settings,
	tmplName string,
	tmplValue string,
	tmplData any,
	ignoreMissingTemplateValues bool,
) (string, error)

ProcessTmplWithDatasources parses and executes Go templates with datasources

func ProcessYAMLConfigFile added in v1.81.0

func ProcessYAMLConfigFile(
	atmosConfig schema.AtmosConfiguration,
	basePath string,
	filePath string,
	importsConfig map[string]map[string]any,
	context map[string]any,
	ignoreMissingFiles bool,
	skipTemplatesProcessingInImports bool,
	ignoreMissingTemplateValues bool,
	skipIfMissing bool,
	parentTerraformOverridesInline map[string]any,
	parentTerraformOverridesImports map[string]any,
	parentHelmfileOverridesInline map[string]any,
	parentHelmfileOverridesImports map[string]any,
	atmosManifestJsonSchemaFilePath string,
) (
	map[string]any,
	map[string]map[string]any,
	map[string]any,
	map[string]any,
	map[string]any,
	map[string]any,
	map[string]any,
	error,
)

ProcessYAMLConfigFile takes a path to a YAML stack manifest, recursively processes and deep-merges all imports, and returns the final stack config

func ProcessYAMLConfigFiles added in v1.81.0

func ProcessYAMLConfigFiles(
	atmosConfig schema.AtmosConfiguration,
	stacksBasePath string,
	terraformComponentsBasePath string,
	helmfileComponentsBasePath string,
	filePaths []string,
	processStackDeps bool,
	processComponentDeps bool,
	ignoreMissingFiles bool,
) (
	[]string,
	map[string]any,
	map[string]map[string]any,
	error,
)

ProcessYAMLConfigFiles takes a list of paths to stack manifests, processes and deep-merges all imports, and returns a list of stack configs

func ReadAndProcessComponentVendorConfigFile added in v1.47.0

func ReadAndProcessComponentVendorConfigFile(
	atmosConfig *schema.AtmosConfiguration,
	component string,
	componentType string,
) (schema.VendorComponentConfig, string, error)

ReadAndProcessComponentVendorConfigFile reads and processes the component vendoring config file `component.yaml`.

func ReadAndProcessVendorConfigFile added in v1.47.0

func ReadAndProcessVendorConfigFile(
	atmosConfig *schema.AtmosConfiguration,
	vendorConfigFile string,
	checkGlobalConfig bool,
) (schema.AtmosVendorConfig, bool, string, error)

ReadAndProcessVendorConfigFile reads and processes the Atmos vendoring config file `vendor.yaml`.

func RunSpinner added in v1.160.3

func RunSpinner(p *tea.Program, spinnerChan chan struct{}, message string)

RunSpinner executes the spinner program in a goroutine

func SanitizeFileName added in v1.153.0

func SanitizeFileName(uri string) string

SanitizeFileName replaces invalid characters and query strings with underscores for Windows.

func StopSpinner added in v1.160.3

func StopSpinner(p *tea.Program, spinnerChan chan struct{})

StopSpinner stops the spinner program and waits for the completion

func TerraformPlanDiff added in v1.166.0

func TerraformPlanDiff(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) error

TerraformPlanDiff represents the plan-diff command implementation.

func ValidateComponent added in v1.9.0

func ValidateComponent(
	atmosConfig schema.AtmosConfiguration,
	componentName string,
	componentSection any,
	schemaPath string,
	schemaType string,
	modulePaths []string,
	timeoutSeconds int,
) (bool, error)

ValidateComponent validates the component config using JsonSchema, OPA or CUE schema documents

func ValidateStacks added in v1.75.0

func ValidateStacks(atmosConfig schema.AtmosConfiguration) error

ValidateStacks validates Atmos stack configuration

func ValidateWithCue added in v1.9.0

func ValidateWithCue(data any, schemaName string, schemaText string) (bool, error)

ValidateWithCue validates the data structure using the provided CUE document https://cuelang.org/docs/integrations/go/#processing-cue-in-go

func ValidateWithJsonSchema added in v1.9.0

func ValidateWithJsonSchema(data any, schemaName string, schemaText string) (bool, error)

ValidateWithJsonSchema validates the data structure using the provided JSON Schema document https://github.com/santhosh-tekuri/jsonschema https://go.dev/play/p/Hhax3MrtD8r

func ValidateWithOpa added in v1.9.0

func ValidateWithOpa(
	data any,
	schemaPath string,
	modulePaths []string,
	timeoutSeconds int,
) (bool, error)

ValidateWithOpa validates the data structure using the provided OPA document https://github.com/open-policy-agent/opa/blob/main/rego/example_test.go https://github.com/open-policy-agent/opa/blob/main/rego/rego_test.go https://www.openpolicyagent.org/docs/latest/integration/#sdk

func ValidateWithOpaLegacy added in v1.38.0

func ValidateWithOpaLegacy(
	data any,
	schemaName string,
	schemaText string,
	timeoutSeconds int,
) (bool, error)

ValidateWithOpaLegacy validates the data structure using the provided OPA document https://www.openpolicyagent.org/docs/latest/integration/#sdk

Types

type AtmosFuncs added in v1.81.0

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

func (AtmosFuncs) Component added in v1.81.0

func (f AtmosFuncs) Component(component string, stack string) (any, error)

func (AtmosFuncs) GomplateDatasource added in v1.84.0

func (f AtmosFuncs) GomplateDatasource(alias string, args ...string) (any, error)

func (AtmosFuncs) Store added in v1.171.0

func (f AtmosFuncs) Store(store string, stack string, component string, key string) (any, error)

type ComponentSkipFunc added in v1.166.0

type ComponentSkipFunc func(os.FileInfo, string, string) (bool, error)

type CopyContext added in v1.168.0

type CopyContext struct {
	SrcDir   string
	DstDir   string
	BaseDir  string
	Excluded []string
	Included []string
}

CopyContext groups parameters for directory copy operations.

type DescribeAffectedCmdArgs added in v1.87.0

type DescribeAffectedCmdArgs struct {
	CLIConfig                   schema.AtmosConfiguration
	CloneTargetRef              bool
	Format                      string
	IncludeDependents           bool
	IncludeSettings             bool
	IncludeSpaceliftAdminStacks bool
	Logger                      *l.Logger
	OutputFile                  string
	Ref                         string
	RepoPath                    string
	SHA                         string
	SSHKeyPath                  string
	SSHKeyPassword              string
	Verbose                     bool
	Upload                      bool
	Stack                       string
	Query                       string
	ProcessTemplates            bool
	ProcessYamlFunctions        bool
	Skip                        []string
}

type Directory added in v1.114.0

type Directory struct {
	Name         string
	FullPath     string
	RelativePath string
	Files        []ObjectInfo
}

func CollectDirectoryObjects added in v1.114.0

func CollectDirectoryObjects(basePath string, patterns []string) ([]Directory, error)

type ObjectInfo added in v1.114.0

type ObjectInfo struct {
	FullPath     string
	RelativePath string
	Name         string
	IsDir        bool
}

type PlanFileOptions added in v1.166.0

type PlanFileOptions struct {
	ComponentPath string
	OrigPlanFile  string
	NewPlanFile   string
	TmpDir        string
}

PlanFileOptions contains parameters for plan file operations.

type PlanfileOptions added in v1.172.0

type PlanfileOptions struct {
	Component            string
	Stack                string
	Format               string
	File                 string
	ProcessTemplates     bool
	ProcessYamlFunctions bool
	Skip                 []string
}

PlanfileOptions holds the options for generating a Terraform planfile.

type PrefixCopyContext added in v1.168.0

type PrefixCopyContext struct {
	SrcDir     string
	DstDir     string
	GlobalBase string
	Prefix     string
	Excluded   []string
}

PrefixCopyContext groups parameters for prefix-based copy operations.

type ProLockCmdArgs added in v1.87.0

type ProLockCmdArgs struct {
	ProLockUnlockCmdArgs
	LockMessage string
	LockTTL     int32
}

type ProLockUnlockCmdArgs added in v1.87.0

type ProLockUnlockCmdArgs struct {
	Component string
	Logger    *l.Logger
	Stack     string
}

type ProUnlockCmdArgs added in v1.87.0

type ProUnlockCmdArgs struct {
	ProLockUnlockCmdArgs
}

type VendorFlags added in v1.166.0

type VendorFlags struct {
	DryRun        bool
	Component     string
	Stack         string
	Tags          []string
	Everything    bool
	ComponentType string
}

Jump to

Keyboard shortcuts

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