terraform

package
v0.0.0-...-5773fff Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlanHasNoChanges = iota
	PlanHasChanges
	PlanHasDestructiveChanges
)

Variables

View Source
var (
	ErrRunnerStopped         = errors.New("Terraform runner was stopped.")
	ErrTerraformApplyAborted = errors.New("Terraform apply aborted.")
)

Functions

func CheckBaseInfrastructurePipeline

func CheckBaseInfrastructurePipeline(r *Runner, name string) (int, error)

func CheckPipeline

func CheckPipeline(r *Runner, name string) (int, error)

func DestroyPipeline

func DestroyPipeline(r *Runner, name string) error

Types

type CMDExecutor

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

CMDExecutor straightforward cmd executor which provides convenient output and handles quit signal.

func (*CMDExecutor) Exec

func (c *CMDExecutor) Exec(args ...string) (int, error)

func (*CMDExecutor) Output

func (c *CMDExecutor) Output(args ...string) ([]byte, error)

func (*CMDExecutor) Stop

func (c *CMDExecutor) Stop()

type ChangeActionSettings

type ChangeActionSettings struct {
	AutoDismissDestructive bool
	AutoApprove            bool
	SkipChangesOnDeny      bool
}

type DummyHook

type DummyHook struct{}

func (*DummyHook) AfterAction

func (c *DummyHook) AfterAction() error

func (*DummyHook) BeforeAction

func (c *DummyHook) BeforeAction() (runPostAction bool, err error)

func (*DummyHook) IsReady

func (c *DummyHook) IsReady() error

type Executor

type Executor interface {
	Output(...string) ([]byte, error)
	Exec(...string) (int, error)
	Stop()
}

type InfraActionHook

type InfraActionHook interface {
	BeforeAction() (runAfterAction bool, err error)
	IsReady() error
	AfterAction() error
}

type PipelineOutputs

type PipelineOutputs struct {
	TerraformState []byte
	CloudDiscovery []byte

	BastionHost string

	MasterIPForSSH     string
	NodeInternalIP     string
	KubeDataDevicePath string
}

func ApplyPipeline

func ApplyPipeline(r *Runner, name string, extractFn func(r *Runner) (*PipelineOutputs, error)) (*PipelineOutputs, error)

func GetBaseInfraResult

func GetBaseInfraResult(r *Runner) (*PipelineOutputs, error)

func GetMasterNodeResult

func GetMasterNodeResult(r *Runner) (*PipelineOutputs, error)

func OnlyState

func OnlyState(r *Runner) (*PipelineOutputs, error)

type Runner

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

func NewImmutableRunnerFromConfig

func NewImmutableRunnerFromConfig(cfg *config.MetaConfig, step string) *Runner

func NewRunner

func NewRunner(provider, prefix, layout, step string, stateCache state.Cache) *Runner

func NewRunnerFromConfig

func NewRunnerFromConfig(cfg *config.MetaConfig, step string, stateCache state.Cache) *Runner

func (*Runner) Apply

func (r *Runner) Apply() error

func (*Runner) Destroy

func (r *Runner) Destroy() error

func (*Runner) GetTerraformOutput

func (r *Runner) GetTerraformOutput(output string) ([]byte, error)

func (*Runner) Init

func (r *Runner) Init() error

func (*Runner) Plan

func (r *Runner) Plan() error

func (*Runner) ResourcesQuantityInState

func (r *Runner) ResourcesQuantityInState() int

func (*Runner) Stop

func (r *Runner) Stop()

Stop interrupts the current runner command and sets a flag to prevent executions of next runner commands.

func (*Runner) WithAdditionalStateSaverDestination

func (r *Runner) WithAdditionalStateSaverDestination(destinations ...SaverDestination) *Runner

WithAdditionalStateSaverDestination by default we use intermediate save state to cache destination

func (*Runner) WithAllowedCachedState

func (r *Runner) WithAllowedCachedState(flag bool) *Runner

func (*Runner) WithAutoApprove

func (r *Runner) WithAutoApprove(flag bool) *Runner

func (*Runner) WithAutoDismissDestructiveChanges

func (r *Runner) WithAutoDismissDestructiveChanges(flag bool) *Runner

func (*Runner) WithCache

func (r *Runner) WithCache(cache state.Cache) *Runner

func (*Runner) WithConfirm

func (r *Runner) WithConfirm(confirm func() *input.Confirmation) *Runner

func (*Runner) WithHook

func (r *Runner) WithHook(h InfraActionHook) *Runner

func (*Runner) WithName

func (r *Runner) WithName(name string) *Runner

func (*Runner) WithSkipChangesOnDeny

func (r *Runner) WithSkipChangesOnDeny(flag bool) *Runner

func (*Runner) WithState

func (r *Runner) WithState(stateData []byte) *Runner

func (*Runner) WithStatePath

func (r *Runner) WithStatePath(statePath string) *Runner

func (*Runner) WithVariables

func (r *Runner) WithVariables(variablesData []byte) *Runner

type SaverDestination

type SaverDestination interface {
	SaveState(outputs *PipelineOutputs) error
}

type StateSaver

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

func NewStateSaver

func NewStateSaver(destinations []SaverDestination) *StateSaver

func (*StateSaver) DoneCh

func (s *StateSaver) DoneCh() chan struct{}

func (*StateSaver) FsEventHandler

func (s *StateSaver) FsEventHandler(event fsnotify.Event)

func (*StateSaver) IsStarted

func (s *StateSaver) IsStarted() bool

func (*StateSaver) Start

func (s *StateSaver) Start(runner *Runner) error

Start creates a new file watcher for r.statePath and a chan to stop it.

func (*StateSaver) Stop

func (s *StateSaver) Stop()

Stop is blocked until doneCh is closed.

Jump to

Keyboard shortcuts

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