Documentation ¶
Overview ¶
Package stack defines all functionality around stacks, like loading, listing all stacks, etc.
Index ¶
- Constants
- func Clone(root *config.Root, destdir, srcdir string, skipChildStacks bool) (int, error)
- func Create(root *config.Root, stack config.Stack, imports ...string) (err error)
- func UpdateStackID(stackdir string) (string, error)
- type Entry
- type EntrySlice
- type EvalCtx
- type Manager
- type RepoChecks
- type Report
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 contain at least one stack directly, or in subdirs unless skipChildStacks is set (fail otherwise) - destdir must not exist (fail otherwise) - if skipChildStacks is true, child stacks are ignored - 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 NewGitAwareManager ¶ added in v0.4.4
NewGitAwareManager returns a stack manager that supports change detection.
func NewManager ¶
NewManager creates a new stack manager.
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.