terraclient

package
v0.0.0-...-862afa6 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoStackName        = errors.New("no stack name")
	ErrDuplicateStackName = errors.New("duplicate stack name")
)

Functions

func WithDefaultApply

func WithDefaultApply(b bool) func(o *clientOpts)

func WithDefaultDestroy

func WithDefaultDestroy(b bool) func(o *clientOpts)

func WithDefaultPlan

func WithDefaultPlan(b bool) func(o *clientOpts)

func WithRunApply

func WithRunApply(b bool) func(o *runOpts)

func WithRunDestroy

func WithRunDestroy(b bool) func(o *runOpts)

func WithRunPlan

func WithRunPlan(b bool) func(o *runOpts)

Types

type Client

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

Client runs Terraform stacks and keeps a record of the runs in order to provide a summary of the changes

func NewClient

func NewClient(opts ...func(*clientOpts)) *Client

func (*Client) Run

func (r *Client) Run(
	ctx context.Context,
	stack Stacker,
	opts ...func(*runOpts),
) error

func (*Client) Stacks

func (r *Client) Stacks() []Stacker

type Plan

type Plan struct {
	AddResources     []*tfjson.ResourceChange
	ChangeResources  []*tfjson.ResourceChange
	DestroyResources []*tfjson.ResourceChange
}

func (*Plan) HasDrift

func (p *Plan) HasDrift() bool

type Stack

type Stack struct {
	// Name is the unique name of the Stack.
	// It is used for the working directory where the Terraform code is
	// generated and the Terraform CLI is executed.
	Name string `lingon:"-" validate:"required"`
	// contains filtered or unexported fields
}

func (*Stack) IsStateComplete

func (r *Stack) IsStateComplete() bool

func (*Stack) Plan

func (r *Stack) Plan() *Plan

func (*Stack) SetPlan

func (r *Stack) SetPlan(tfplan *tfjson.Plan)

func (*Stack) SetStateMode

func (r *Stack) SetStateMode(sm StateMode)

func (*Stack) StackName

func (r *Stack) StackName() string

func (*Stack) StateMode

func (r *Stack) StateMode() StateMode

func (*Stack) Terriyaki

func (*Stack) Terriyaki()

type Stacker

type Stacker interface {
	terra.Exporter
	StackName() string
	SetPlan(*tfjson.Plan)
	SetStateMode(StateMode)
	IsStateComplete() bool
	Plan() *Plan
}
	IAMRole    aws.IamRole
	EKSCluster aws.EksCluster
	...
}

type StateMode

type StateMode int
const (
	// StateModeUnknown the state mode has not been determined yet (no plan/apply)
	StateModeUnknown StateMode = 0
	// StateModeEmpty there is no state (no apply yet)
	StateModeEmpty StateMode = 1
	// StateModePartial there is a state, but there are resources in the Stack
	// that are not in the state yet (need to be applied)
	StateModePartial StateMode = 2
	// StateModeComplete the Stack and Terraform state are in complete sync
	StateModeComplete StateMode = 3
)

Jump to

Keyboard shortcuts

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