Sparta: Index | Examples | Files | Directories

package cloudformation

import ""

Package cloudformation scopes CloudFormation-specific utiltities for Sparta



Package Files

doc.go util.go

func CloudFormationResourceName Uses

func CloudFormationResourceName(prefix string, parts ...string) string

CloudFormationResourceName returns a name suitable as a logical CloudFormation resource value. See for more information. The `prefix` value should provide a hint as to the resource type (eg, `SNSConfigurator`, `ImageTranscoder`). Note that the returned name is not content-addressable.

func ConvergeStackState Uses

func ConvergeStackState(serviceName string,
    cfTemplate *gocf.Template,
    templateURL string,
    tags map[string]string,
    startTime time.Time,
    awsSession *session.Session,
    logger *logrus.Logger) (*cloudformation.Stack, error)

ConvergeStackState ensures that the serviceName converges to the template state defined by cfTemplate. This function establishes a polling loop to determine when the stack operation has completed.

func ConvertToTemplateExpression Uses

func ConvertToTemplateExpression(templateData io.Reader, additionalUserTemplateProperties map[string]interface{}) (*gocf.StringExpr, error)

ConvertToTemplateExpression transforms the templateData contents into an Fn::Join- compatible representation for template serialization. The templateData contents may include both golang text/template properties and single-line JSON Fn::Join supported serializations.


package main

import (

var sampleTemplate = `
SPARTA_CICD_BINARY_PATH=/home/ubuntu/{{ .ServiceName }}.lambda.amd64
POSTGRES_ADDRESS={ "Fn::GetAtt" : [ "{{ .PostgreSQLCloudFormationResource }}" , "Endpoint.Address" ] }
var sampleTemplateProps = map[string]interface{}{
    "Username":                         "MyPassword",
    "Password":                         "MyPassword",
    "PostgreSQLCloudFormationResource": "DBInstance0bef52bca519f672fddf3a6e0cbf1325e0a3263c",

func main() {
    templateReader := strings.NewReader(sampleTemplate)
    ConvertToTemplateExpression(templateReader, sampleTemplateProps)

func MapToResourceTags Uses

func MapToResourceTags(tagMap map[string]string) []interface{}

MapToResourceTags transforms a go map[string]string to a CloudFormation-compliant Tags representation. See

func S3AllKeysArnForBucket Uses

func S3AllKeysArnForBucket(bucket interface{}) *gocf.StringExpr

S3AllKeysArnForBucket returns a CloudFormation-compatible Arn expression (string or Ref) for all bucket keys (`/*`). The bucket parameter may be either a string or an interface{} ("Ref: "myResource") value

func S3ArnForBucket Uses

func S3ArnForBucket(bucket interface{}) *gocf.StringExpr

S3ArnForBucket returns a CloudFormation-compatible Arn expression (string or Ref) suitable for template reference. The bucket parameter may be either a string or an interface{} ("Ref: "myResource") value

func StackEvents Uses

func StackEvents(stackID string,
    eventFilterLowerBound time.Time,
    awsSession *session.Session) ([]*cloudformation.StackEvent, error)

StackEvents returns the slice of cloudformation.StackEvents for the given stackID or stackName

func StackExists Uses

func StackExists(stackNameOrID string, awsSession *session.Session, logger *logrus.Logger) (bool, error)

StackExists returns whether the given stackName or stackID currently exists

func UploadTemplate Uses

func UploadTemplate(serviceName string,
    cfTemplate *gocf.Template,
    s3Bucket string,
    s3KeyName string,
    awsSession *session.Session,
    logger *logrus.Logger) (string, error)

UploadTemplate marshals the given cfTemplate and uploads it to the supplied bucket using the given KeyName

type AutoIncrementingLambdaVersionInfo Uses

type AutoIncrementingLambdaVersionInfo struct {
    // The version that will be published as part of this operation
    CurrentVersion int
    // The CloudFormation resource name that defines the
    // AWS::Lambda::Version resource to be included with this operation
    CurrentVersionResourceName string
    // The version history that maps a published version value
    // to its CloudFormation resource name. Used for defining lagging
    // indicator Alias values
    VersionHistory map[int]string

AutoIncrementingLambdaVersionInfo is dynamically populated during a call AddAutoIncrementingLambdaVersionResource. The VersionHistory is a map of published versions to their CloudFormation resource names

func AddAutoIncrementingLambdaVersionResource Uses

func AddAutoIncrementingLambdaVersionResource(serviceName string,
    lambdaResourceName string,
    cfTemplate *gocf.Template,
    logger *logrus.Logger) (*AutoIncrementingLambdaVersionInfo, error)

AddAutoIncrementingLambdaVersionResource inserts a new AWS::Lambda::Version resource into the template. It uses the existing CloudFormation template representation to determine the version index to append. The returned map is from `versionIndex`->`CloudFormationResourceName` to support second-order AWS::Lambda::Alias records on a per-version level

type WaitForStackOperationCompleteResult Uses

type WaitForStackOperationCompleteResult struct {
    // contains filtered or unexported fields

WaitForStackOperationCompleteResult encapsulates the stackInfo following a WaitForStackOperationComplete call

func WaitForStackOperationComplete Uses

func WaitForStackOperationComplete(stackID string,
    pollingMessage string,
    awsCloudFormation *cloudformation.CloudFormation,
    logger *logrus.Logger) (*WaitForStackOperationCompleteResult, error)

WaitForStackOperationComplete is a blocking, polling based call that periodically fetches the stackID set of events and uses the state value to determine if an operation is complete



Package cloudformation imports 20 packages (graph) and is imported by 1 packages. Updated 2017-03-28. Refresh now. Tools for package owners.