cloudformation

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package cloudformation provides functionality to deploy CLI concepts with AWS CloudFormation.

Package cloudformation provides functionality to deploy ECS resources with AWS CloudFormation.

Package cloudformation provides functionality to deploy ECS resources with AWS CloudFormation. This file defines API for deploying a pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWorkloadToAppOptWithoutECR added in v1.28.0

func AddWorkloadToAppOptWithoutECR(s *stack.AppResourcesWorkload)

AddWorkloadToAppOptWithoutECR adds a workload to app without creating an ECR repo.

func IsEmptyErr added in v1.21.0

func IsEmptyErr(err error) bool

IsEmptyErr returns true if the error occurred because the cloudformation resource does not exist or does not contain any sub-resources.

Types

type AddEnvToAppOpts added in v1.4.0

type AddEnvToAppOpts struct {
	App          *config.Application
	EnvName      string
	EnvAccountID string
	EnvRegion    string
}

AddEnvToAppOpts contains the parameters to call AddEnvToApp.

type AddWorkloadToAppOpt added in v1.28.0

type AddWorkloadToAppOpt func(*stack.AppResourcesWorkload)

AddWorkloadToAppOpt allows passing optional parameters to AddServiceToApp.

type CloudFormation

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

CloudFormation wraps the CloudFormationAPI interface

func New

func New(sess *session.Session, opts ...OptFn) CloudFormation

New returns a configured CloudFormation client.

func (CloudFormation) AddEnvToApp

func (cf CloudFormation) AddEnvToApp(opts *AddEnvToAppOpts) error

AddEnvToApp takes a new environment and updates the application configuration with new Account IDs in resource policies (KMS Keys and ECR Repos) - and sets up a new stack instance if the environment is in a new region.

func (CloudFormation) AddJobToApp added in v0.5.0

func (cf CloudFormation) AddJobToApp(app *config.Application, jobName string, opts ...AddWorkloadToAppOpt) error

AddJobToApp attempts to add new job-specific resources to the application resource stack. Currently, this means that we'll set up an ECR repo with a policy for all envs to be able to pull from it.

func (CloudFormation) AddPipelineResourcesToApp

func (cf CloudFormation) AddPipelineResourcesToApp(
	app *config.Application, appRegion string) error

AddPipelineResourcesToApp conditionally adds resources needed to support a pipeline in the application region (i.e. the same region that hosts our SSM store). This is necessary because the application region might not contain any environment.

func (CloudFormation) AddServiceToApp

func (cf CloudFormation) AddServiceToApp(app *config.Application, svcName string, opts ...AddWorkloadToAppOpt) error

AddServiceToApp attempts to add new service specific resources to the application resource stack. Currently, this means that we'll set up an ECR repo with a policy for all envs to be able to pull from it.

func (CloudFormation) CreateAndRenderEnvironment added in v1.19.0

func (cf CloudFormation) CreateAndRenderEnvironment(conf StackConfiguration, bucketARN string) error

CreateAndRenderEnvironment creates the CloudFormation stack for an environment, and render the stack creation to out.

func (CloudFormation) CreatePipeline

func (cf CloudFormation) CreatePipeline(bucketName string, stackConfig StackConfiguration) error

CreatePipeline sets up a new CodePipeline for deploying services.

func (CloudFormation) DelegateDNSPermissions

func (cf CloudFormation) DelegateDNSPermissions(app *config.Application, accountID string) error

DelegateDNSPermissions grants the provided account ID the ability to write to this application's DNS HostedZone. This allows us to perform cross account DNS delegation.

func (CloudFormation) DeleteApp

func (cf CloudFormation) DeleteApp(appName string) error

DeleteApp deletes all application specific StackSet and Stack resources.

func (CloudFormation) DeleteEnvironment

func (cf CloudFormation) DeleteEnvironment(appName, envName, cfnExecRoleARN string) error

DeleteEnvironment deletes the CloudFormation stack of an environment.

func (CloudFormation) DeletePipeline

func (cf CloudFormation) DeletePipeline(pipeline deploy.Pipeline) error

DeletePipeline removes the CodePipeline stack.

func (CloudFormation) DeleteTask added in v1.1.0

func (cf CloudFormation) DeleteTask(task deploy.TaskStackInfo) error

DeleteTask deletes a Copilot-created one-off task stack using the RoleARN that stack was created with. If there is no role arn specified, it tries to delete the stack using the default session.

func (CloudFormation) DeleteWorkload added in v0.5.0

func (cf CloudFormation) DeleteWorkload(in deploy.DeleteWorkloadInput) error

DeleteWorkload removes the CloudFormation stack of a deployed workload.

func (CloudFormation) DeployApp

func (cf CloudFormation) DeployApp(in *deploy.CreateAppInput) error

DeployApp sets up everything required for our application-wide resources. These resources include things that are regional, rather than scoped to a particular environment, such as ECR Repos, CodePipeline KMS keys & S3 buckets. We deploy application resources through StackSets - that way we can have one template that we update and all regional stacks are updated.

func (CloudFormation) DeployService

func (cf CloudFormation) DeployService(conf StackConfiguration, bucketName string, detach bool, opts ...cloudformation.StackOption) error

DeployService deploys a service stack and renders progress updates to out until the deployment is done. If the service stack doesn't exist, then it creates the stack. If the service stack already exists, it updates the stack.

func (CloudFormation) DeployTask

DeployTask deploys a task stack, renders the deployment to out until it is done. If the task stack doesn't exist, then it creates the stack. If the task stack already exists, it updates the stack. If the task stack doesn't have any changes, it returns nil

func (CloudFormation) DeployedEnvironmentParameters added in v1.21.1

func (cf CloudFormation) DeployedEnvironmentParameters(appName, envName string) ([]*awscfn.Parameter, error)

DeployedEnvironmentParameters returns the environment stack's parameters.

func (CloudFormation) ForceUpdateOutputID added in v1.20.0

func (cf CloudFormation) ForceUpdateOutputID(app, env string) (string, error)

ForceUpdateOutputID returns the environment stack's last force update ID.

func (CloudFormation) GetAppResourcesByRegion

func (cf CloudFormation) GetAppResourcesByRegion(app *config.Application, region string) (*stack.AppRegionalResources, error)

GetAppResourcesByRegion fetches all the regional resources for a particular region.

func (CloudFormation) GetEnvironment

func (cf CloudFormation) GetEnvironment(appName, envName string) (*config.Environment, error)

GetEnvironment returns the Environment metadata from the CloudFormation stack.

func (CloudFormation) GetRegionalAppResources

func (cf CloudFormation) GetRegionalAppResources(app *config.Application) ([]*stack.AppRegionalResources, error)

GetRegionalAppResources fetches all the regional resources for a particular application.

func (CloudFormation) GetTaskStack added in v1.2.0

func (cf CloudFormation) GetTaskStack(taskName string) (*deploy.TaskStackInfo, error)

GetTaskStack grabs information about the given one-off task's cloudformation stack and returns it to the user in a convenient struct.

func (CloudFormation) ListDefaultTaskStacks added in v1.1.0

func (cf CloudFormation) ListDefaultTaskStacks() ([]deploy.TaskStackInfo, error)

ListDefaultTaskStacks returns all the CF stacks created by copilot but not associated with an application.

func (CloudFormation) ListTaskStacks added in v1.1.0

func (cf CloudFormation) ListTaskStacks(appName, envName string) ([]deploy.TaskStackInfo, error)

ListTaskStacks returns all the CF stacks which represent one-off copilot tasks in a given application's environments.

func (CloudFormation) PipelineExists

func (cf CloudFormation) PipelineExists(stackConfig StackConfiguration) (bool, error)

PipelineExists checks if the pipeline with the provided config exists.

func (CloudFormation) RemoveEnvFromApp added in v1.29.0

func (cf CloudFormation) RemoveEnvFromApp(opts *RemoveEnvFromAppOpts) error

RemoveEnvFromApp optionally redeploys the app stack to remove the account and, if necessary, empties ECR repos and a regional S3 bucket before deleting the stackset instance for that region. This method cannot check that deleting the stackset or removing the app won't break copilot. Be careful.

func (CloudFormation) RemoveJobFromApp added in v0.5.0

func (cf CloudFormation) RemoveJobFromApp(app *config.Application, jobName string) error

RemoveJobFromApp attempts to remove job-specific resources (ECR repositories) from the application resource stack.

func (CloudFormation) RemoveServiceFromApp

func (cf CloudFormation) RemoveServiceFromApp(app *config.Application, svcName string) error

RemoveServiceFromApp attempts to remove service-specific resources (ECR repositories) from the application resource stack.

func (CloudFormation) Template added in v1.27.0

func (cf CloudFormation) Template(stackName string) (string, error)

Template returns a deployed stack's template.

func (CloudFormation) UpdateAndRenderEnvironment added in v1.19.0

func (cf CloudFormation) UpdateAndRenderEnvironment(conf StackConfiguration, bucketARN string, detach bool, opts ...cloudformation.StackOption) error

UpdateAndRenderEnvironment updates the CloudFormation stack for an environment, and render the stack creation to out.

func (CloudFormation) UpdateEnvironmentTemplate added in v0.5.0

func (cf CloudFormation) UpdateEnvironmentTemplate(appName, envName, templateBody, cfnExecRoleARN string) error

UpdateEnvironmentTemplate updates the cloudformation stack's template body while maintaining the parameters and tags.

func (CloudFormation) UpdatePipeline

func (cf CloudFormation) UpdatePipeline(bucketName string, stackConfig StackConfiguration) error

UpdatePipeline updates an existing CodePipeline for deploying services.

func (CloudFormation) UpgradeApplication added in v1.5.0

func (cf CloudFormation) UpgradeApplication(in *deploy.CreateAppInput) error

UpgradeApplication upgrades the application stack to the latest version.

type ErrStackDeletedOnInterrupt added in v1.29.1

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

ErrStackDeletedOnInterrupt means stack is deleted on interrupt.

func (*ErrStackDeletedOnInterrupt) Error added in v1.29.1

type ErrStackUpdateCanceledOnInterrupt added in v1.29.1

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

ErrStackUpdateCanceledOnInterrupt means stack update is canceled on interrupt.

func (*ErrStackUpdateCanceledOnInterrupt) Error added in v1.29.1

type OptFn added in v1.21.0

type OptFn func(cfn *CloudFormation)

OptFn represents an optional configuration function for the CloudFormation client.

func WithProgressTracker added in v1.21.0

func WithProgressTracker(fw progress.FileWriter) OptFn

WithProgressTracker updates the CloudFormation client to write stack updates to a file.

type Overrider added in v1.26.0

type Overrider interface {
	Override(body []byte) (out []byte, err error)
}

An Overrider transforms the content in body to out.

type RemoveEnvFromAppOpts added in v1.29.0

type RemoveEnvFromAppOpts struct {
	App          *config.Application
	EnvToDelete  *config.Environment
	Environments []*config.Environment
}

RemoveEnvFromAppOpts contains the parameters to call RemoveEnvFromApp.

type StackConfiguration

type StackConfiguration interface {
	StackName() string
	Template() (string, error)
	Parameters() ([]*sdkcloudformation.Parameter, error)
	Tags() []*sdkcloudformation.Tag
	SerializedParameters() (string, error)
}

StackConfiguration represents the set of methods needed to deploy a cloudformation stack.

func WrapWithTemplateOverrider added in v1.26.0

func WrapWithTemplateOverrider(stack StackConfiguration, overrider Overrider) StackConfiguration

WrapWithTemplateOverrider returns a wrapped stack, such that Template calls returns an overriden stack template.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package stack provides functionality to transform manifest files and additional runtime configuration into CloudFormation stacks.
Package stack provides functionality to transform manifest files and additional runtime configuration into CloudFormation stacks.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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