Documentation ¶
Overview ¶
Package stack defines all functionality around stacks, like loading, listing all stacks, etc.
Index ¶
Constants ¶
const ( // ErrInvalidStackDir indicates that the given stack dir is invalid. ErrInvalidStackDir errors.Kind = "invalid stack directory" // ErrStackAlreadyExists indicates that the stack already exists and cant be created. ErrStackAlreadyExists errors.Kind = "stack already exists" // ErrStackDefaultCfgFound indicates that the dir already has a default // stack configuration. ErrStackDefaultCfgFound errors.Kind = "default configuration file for stack already exists" )
const DefaultFilename = "stack.tm.hcl"
DefaultFilename is the default file name for created stacks.
const ( // ErrCloneDestDirExists indicates that the dest dir on a clone // operation already exists. ErrCloneDestDirExists errors.Kind = "clone dest dir exists" )
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
Clone will clone the stack at srcdir into destdir.
- srcdir must be a stack (fail otherwise) - destdir must not exist (fail otherwise) - All files and directories are copied (except dotfiles/dirs) - If cloned stack has an ID it will be adjusted to a generated UUID. - If cloned stack has no ID the cloned stack also won't have an ID.
func Create ¶
Create creates the provided stack on the filesystem. The list of import paths provided are generated inside the stack file.
If the stack already exists it will return an error and no changes will be made to the stack.
func UpdateStackID ¶ added in v0.3.1
UpdateStackID updates the stack.id of the given stack directory. The functions updates just the file which defines the stack block. The updated file will lose all comments.
Types ¶
type EntrySlice ¶
type EntrySlice []Entry
EntrySlice implements the Sort interface.
func (EntrySlice) Len ¶
func (x EntrySlice) Len() int
func (EntrySlice) Less ¶
func (x EntrySlice) Less(i, j int) bool
func (EntrySlice) Swap ¶
func (x EntrySlice) Swap(i, j int)
type EvalCtx ¶
EvalCtx represents the evaluation context of a stack.
func NewEvalCtx ¶
NewEvalCtx creates a new stack evaluation context.
func (*EvalCtx) SetGlobals ¶
SetGlobals sets the given globals in the stack evaluation context.
func (*EvalCtx) SetMetadata ¶
SetMetadata sets the given metadata in the stack evaluation context.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the terramate stacks manager.
func NewManager ¶
NewManager creates a new stack manager.The root is the project root config and and gitBaseRef is the git reference to compare for changes.
func (*Manager) AddWantedOf ¶
func (m *Manager) AddWantedOf(scopeStacks config.List[*config.SortableStack]) (config.List[*config.SortableStack], error)
AddWantedOf returns all wanted stacks from the given stacks.
func (*Manager) List ¶
List walks the basedir directory looking for terraform stacks. It returns a lexicographic sorted list of stack directories.
func (*Manager) ListChanged ¶
ListChanged lists the stacks that have changed on the current branch, compared to the main branch. This method assumes a version control system in place and that you are working on a branch that is not main. It's an error to call this method in a directory that's not inside a repository or a repository with no commits in it.
type RepoChecks ¶
RepoChecks contains the info of default checks.
type Report ¶
type Report struct { Stacks []Entry // Checks contains the result info of default checks. Checks RepoChecks }
Report is the report of project's stacks and the result of its default checks.