awscfn

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package awscfn contains helper functions that query/manipulate AWS Cloudformation stacks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteStack added in v1.8.0

func DeleteStack(client *cloudformation.CloudFormation, logger *zap.SugaredLogger, stackName string, pollInterval time.Duration) error

Trigger stack deletion and wait for it to finish.

func ErrStackDoesNotExist

func ErrStackDoesNotExist(err error) bool

Returns true if the given error is from describing a stack that doesn't exist.

func FlattenStackOutputs

func FlattenStackOutputs(stack *cloudformation.Stack) map[string]string

FlattenStackOutputs flatten CloudFormation stack outputs into a string map.

func LogResourceFailures

func LogResourceFailures(client *cloudformation.CloudFormation, logger *zap.SugaredLogger, stackID *string, start time.Time)

Log failed resources from the stack's event history.

Use this after a stack create/update/delete fails to understand why the stack failed. Events from nested stacks which failed are enumerated as well.

func StackOutputs

func StackOutputs(client *cloudformation.CloudFormation, stacks ...string) (map[string]string, error)

Returns combined outputs from one or more stacks. Treats errors as fatal.

func StackTag

func StackTag(client *cloudformation.CloudFormation, tagKey, stack string) (string, error)

StackTag returns the tag value for specified tag key for the given stack, will be blank if the stack or tag does not exist.

func WaitForStack

func WaitForStack(client *cloudformation.CloudFormation, logger *zap.SugaredLogger, stackName, successStatus string,
	pollInterval time.Duration, inProgress ...string) (*cloudformation.Stack, error)

Wait for the stack to reach a terminal status and then return its details.

1) Keep waiting while stack status is inProgress 2) If stack status is successStatus, return stack details 3) If stack status is neither success nor inProgress, log failing resources and return an error

This allows us to report errors to the user immediately, e.g. an "UPDATE_ROLLBACK_IN_PROGRESS" is considered a failed update - we don't have to wait until the stack is finished before finding and logging the errors.

successStatus and inProgress can be omitted to wait for any terminal status.

If the stack does not exist, we report its status as DELETE_COMPLETE

func WaitForStackCreate

func WaitForStackCreate(client *cloudformation.CloudFormation, logger *zap.SugaredLogger, stackName string,
	pollInterval time.Duration) (*cloudformation.Stack, error)

func WaitForStackDelete

func WaitForStackDelete(client *cloudformation.CloudFormation, logger *zap.SugaredLogger, stackName string,
	pollInterval time.Duration) (*cloudformation.Stack, error)

func WaitForStackUpdate

func WaitForStackUpdate(client *cloudformation.CloudFormation, logger *zap.SugaredLogger, stackName string,
	pollInterval time.Duration) (*cloudformation.Stack, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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