deploy

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deploy deploys, destroys and rolls back one stack at a time, as upstream's api/deployments does (EG-2).

It has the rules for what a deployment sends CloudFormation besides the template (G.5): the stack's parameters, resolved from the values given, the deployed values and the template's defaults; its tags; its notification ARNs; its capabilities; and whether its termination protection changes.

Three of upstream's defects there are fixed:

  • parameters that a deployment doesn't set keep their deployed values, as upstream documents and as the CDK CLI behaves, where upstream's library sets them to the template's defaults (G.5-D2); see StackParameters;
  • a parameter key such as "Stack:Param:x" is split at its first colon only, so that CloudFormation rejects the parameter "Param:x" by name, where upstream drops the ":x" and sets "Param" (G.5-D5);
  • a template's default that isn't a string, such as the number 5, is compared with the deployed value as JavaScript's String() writes it, where upstream compares the number with a string and always finds a change (G.5-D7).

Change-set deployment

Upstream's deployStack deploys a stack in one call, with a method switch, and its deploy action calls it twice: once to prepare a change set, and again, after approval, to execute it. Here the deployment is steps on a handle (G.1-D1), which K.3's deploy action runs in upstream's order:

  1. Lookup looks the stack up, deleting it first if its creation failed;
  2. the caller resolves the parameters against the stack Lookup returned, asks CanSkip whether the deployment would change nothing (G.6), and only if it would builds the template body and publishes it if it was uploaded (F.3);
  3. Prepare creates the change set, waits for it and has it diagnosed, returning a ChangeSet;
  4. after approval, ChangeSet.Execute executes it, monitors the deployment and waits for it; on any other way out, ChangeSet.Cleanup removes it.

DescribeExisting is the handle for a change set an earlier command prepared, as for the CLI's --method=execute-change-set. Lookup is a step of its own, though G.1-D1 put it in Prepare, because the parameters, the skip decision and the template body all depend on the stack as it is after a failed creation is cleaned up (G.1-D1, amended).

Every request mirrors upstream's, field for field, as do the messages; the change set's name is the CLI's, DefaultChangeSetName, and the express-mode and rollback checks are upstream's. Every wait is bounded by its context rather than a timeout, so upstream's ChangeSetTimeout can't happen (G.1-D10).

Upstream's defects here that are fixed:

  • rollback has three states, Rollback, so that an express deployment can turn rollback on explicitly, and an express deployment with the default is diagnosed as one that didn't roll back, where upstream tells the diagnoser it did (G.1-D4);
  • an old change set of the same name that fails to delete fails the deployment with its reason, where upstream counts it as gone and then fails to create the new one (G.1-D5);
  • Execute executes the change set Prepare created, by its ARN, where upstream finds it again by name and executes whichever change set another deployment has put there meanwhile (G.1-D6);
  • termination protection is set when the change set is executed, where upstream sets it when it creates the change set, which protects the empty stack of a new one, so that declining fails to clean it up, and changes the stack under --no-execute (G.1-D7);
  • a change set left unexecuted, because it failed, because the deployment was cancelled, or because the caller stopped, is deleted, with the stack it created when that holds no other change sets, where upstream cleans up only after a declined approval, and then deletes any REVIEW_IN_PROGRESS stack (G.1-D8); one cancelled while CloudFormation is still computing it can't be deleted, and Prepare warns that it is left;
  • a stack being deleted is waited for and then created, where upstream treats it as one to update, which CloudFormation refuses (G.1-D9).

A stack that describes assets in its metadata, as CDK v1 apps do, is refused, because publishing those assets isn't ported; the CDK CLI deploys it (EE-3).

Deleting a stack whose creation failed still happens before approval, as upstream's does, since no change set can be created on it. A replacement is looked for among the stack's own resources only, as upstream does: one inside a nested stack doesn't ask for a rollback first.

Validation change set

ValidationChangeSet creates the change set of the validate action's online validation, which is never executed, and returns its diagnosis, as upstream's createValidationChangeSet does (M.10). Its request is upstream's, field for field, and its cleanup is upstream's validation cleanup, not ChangeSet.Cleanup: it deletes the change set, and the stack only when no stack existed before, in any state, each failure a warning (M.10-D3). What it reads of the stack before creating the change set, whether it exists for an UPDATE and whether it existed at all, is the part of upstream's prepareChangeSetEnv that J.6's diff change set shares (M.10-D2); the rest of that preparation, the roles, the template's publishing and its body, is the toolkit's, which the caller passes in Target and StackInputs.

Diff change set

DiffChangeSet creates the change set of the diff action, which is never executed, and returns its description, as upstream's createDiffChangeSet does (J.6-D7); falling back to a template diff when it fails is the caller's. Its request is upstream's, field for field, and it reads the stack as the validation change set does; Prepare isn't reused, since its messages, description, client token, notification ARNs and deployment config are a deployment's. It returns the change set for the caller to delete once it has described the change sets CloudFormation created for the stack's nested stacks, which deleting it deletes. Its cleanup is a deployment's, ChangeSet.Cleanup, so that a REVIEW_IN_PROGRESS stack is deleted only when no change sets are left on it, where upstream deletes the stack whenever it didn't count as existing, with any change sets someone prepared on it (J.6-D7).

Skipping unchanged deployments

CanSkip makes upstream's checks, in its order and with its messages, before anything is prepared, so that an unchanged deployment makes no change to the stack, not even an empty change set. An unchanged change-set deployment is skipped, as upstream's is since toolkit-lib 1.43.0. Upstream's defects there that are fixed:

  • notification ARNs left alone aren't compared, so a stack whose topics are managed elsewhere can be skipped (G.6-D3);
  • a REVIEW_IN_PROGRESS stack counts as none (G.6-D4).

The CDK CLI's hotswap template cache is read and written here, exactly as the CLI reads and writes it, so that the two can share an assembly directory (M.1-D8): CanSkip refuses to skip a deployment whose template differs from the cache's, upstream's last check, ReadHotswapCache and WriteHotswapCache are internal/hotswap's, and InvalidateHotswapCache deletes the cache when a deployment executed a change set or deployed directly, where upstream deletes it when a deployment starts, before approval (G.6-D5).

Direct deployment

Direct deploys a stack without a change set, by CreateStack or UpdateStack, as upstream's direct method does (G.2): it is the step after Lookup that takes the place of Prepare and Execute, and shares their inputs, StackInputs, and their monitoring and diagnosis. Upstream's defects there that are fixed:

  • a stack paused in a failed state, which CloudFormation updates only with rollback disabled, needs a rollback first when the deployment would roll back, as on the change-set path, where upstream sends UpdateStack and fails (G.2-D2);
  • an empty REVIEW_IN_PROGRESS stack is deleted and then created, and one holding change sets is refused, naming them, where upstream sends CreateStack onto it, which CloudFormation may refuse;
  • the events of a stack Direct creates are all reported, where upstream reports those from its local clock's start time, which skew can lose (G.2-D5); an update still reads from the local clock, as upstream's does.

Refusing an import with the direct method belongs to the importer, G.13, which can refuse before anything changes, where upstream refuses after deleting a failed stack and publishing assets (G.2-D4).

Rollback

RollbackStack rolls back a stack a failed deployment left paused, or whose rollback failed, as upstream's rollbackStack does (G.7); it is a step of its own, since Lookup would delete a stack that failed creation and Target's wait counts a rolled-back creation as a failure (G.7-D1). A forced rollback sends ContinueUpdateRollback's ForceRollback, as upstream does, so that CloudFormation picks the resources to skip, nested stacks' included, and reports what it skipped from the rollback's events. Upstream's defects there that are fixed:

  • a rollback succeeds only when the stack ends rolled back, where upstream counts one the event monitor saw no failure of as a success, whatever status the stack ends in, so that a missed event turns a failed rollback into a success (G.7-D2);
  • the events are read from before the request, where upstream reads them from after it returns, losing the first (G.7-D3);
  • a forced rollback that skipped nothing and still failed stops with its error, where upstream repeats it nine more times (G.7-D4, as revised);
  • resources named to orphan on a stack that must be rolled back first are skipped when that rollback fails, where upstream ignores them (G.7-D5);
  • a stack that doesn't exist is reported as not rollbackable, where upstream fails (G.7-D6).

Destroy

Destroy deletes one stack and waits for it, as upstream's destroyStack does (G.8): it looks the stack up itself, since nothing happens between the lookup and the deletion, and has no diagnoser, as upstream's has none. The destroy action, which orders the stacks with I.1's work graph, resolves the roles and asks for confirmation, is toolkit's (G.8-D1). Upstream's defect there that is fixed: only a deletion that fails is a deployment error, with upstream's message and code, where upstream wraps every error as one, so that a refused request, such as for a stack with termination protection, loses its cause, and a cancelled wait would be reported as a failed deletion (G.8-D3).

Outputs

OutputsFile writes the outputs of the stacks a deployment deploys in the format of upstream's outputs file, which the CDK CLI, the integ-runner and scripts read, and OutputsText is the text of the message that lists them (G.11). The format is upstream's: an object of CloudFormation stack names to objects of output keys to values, as JSON.stringify writes it with two-space indentation, and a final newline. What changes is when the file is written, in what order, and what happens when it can't be; these fixes of upstream's defects take effect when K.3's deploy action wires the file in:

  • the file is written once, when the deployment returns, however it returns, where upstream writes it after each stack that gets far enough, so that stacks finishing together write it at the same time, and a deployment that fails early leaves an earlier run's file (G.11-D3);
  • a file that can't be written doesn't hide the deployment's error: the two are joined, the deployment's first, where upstream's write error replaces it (G.11-D4);
  • stacks and their outputs are in the order of their names and keys, where upstream's are in the order the stacks finished, so the same deployment writes the same bytes (G.11-D5);
  • two selected stacks with one name fail the deployment before anything is deployed, when a file is asked for, where upstream writes the outputs of whichever finished last (G.11-D6).

Cancellation

The steps keep the promise toolkit's package documentation makes for a cancelled action (G.10), by these rules, which the other engine packages follow too:

  • every wait's error wraps its context's and names what it waited for, and a stack's wait says the status it last read, since the operation goes on in CloudFormation (G.10-D1, G.10-D2);
  • a request that starts an operation, CreateChangeSet, ExecuteChangeSet, CreateStack, UpdateStack, DeleteStack, RollbackStack or ContinueUpdateRollback, is sent under context.WithoutCancel once the context is checked, and a termination protection change goes with the request after it as one unit, so that the caller always knows whether the operation started (G.10-D4);
  • once Prepare has created a change set, every way out of it that returns none deletes it, unless NoExecute keeps it, and once it returns one, the caller defers ChangeSet.Cleanup, which does nothing once the change set was executed;
  • cleanup, and the monitor's last read of the events, run under context.WithoutCancel; diagnosis isn't cleanup, and runs under the context;
  • a change set CloudFormation is still computing can't be deleted, so it is left, with a warning (G.10-D5).

Index

Constants

View Source
const DefaultChangeSetName = "cdk-deploy-change-set"

DefaultChangeSetName is the name of the change set a deployment creates when its options don't name one, the CDK CLI's. A deployment deletes any change set of that name on the stack before it creates its own, so two deployments of one stack at once delete each other's change set, as the CLI's do.

Variables

This section is empty.

Functions

func Capabilities

func Capabilities() []types.Capability

Capabilities returns the capabilities every deployment acknowledges, as upstream's and the CDK CLI's do: CAPABILITY_IAM, CAPABILITY_NAMED_IAM and CAPABILITY_AUTO_EXPAND.

func DeployedTemplate

func DeployedTemplate(ctx context.Context, stack *cfnstack.Stack) (*cfntemplate.Object, error)

DeployedTemplate returns the deployed template a change set on stack goes from, which the change set's description is checked against: the stack's template, as cfnstack.Stack.Template reads it, or an empty one, without GetTemplate, when the stack is being deleted. The case of a stack being deleted follows upstream's validation (cfn-api.ts's prepareChangeSetEnv and createValidationChangeSet), not its deployment, which reads such a stack's template.

func InvalidateHotswapCache

func InvalidateHotswapCache(assemblyDir, stackName, account, region string) error

InvalidateHotswapCache deletes the hotswap template cache that the CDK CLI keeps for the stack named stackName in an environment, in the cloud assembly directory assemblyDir: upstream's invalidateHotswapTemplateCache. The deploy action calls it whenever a deployment executed a change set, or deployed directly and changed something, so that a CLI sharing the assembly directory doesn't hotswap against a template the deployment replaced (G.6-D5). A cache that doesn't exist is no error.

func Lookup

func Lookup(ctx context.Context, cfn CloudFormation, io *iohelper.Helper, name string, pollingInterval time.Duration) (*cfnstack.Stack, error)

Lookup looks up the stack to deploy as name, and returns it as the deployment will find it: upstream's lookup at the start of deployStack (G.1-D1, as amended).

A stack whose creation failed, ROLLBACK_COMPLETE or ROLLBACK_FAILED, can't be updated, so it is deleted, and the result is a stack that doesn't exist. It fails with a cdkerr.KindDeployment error with DeploymentCode "FailedStackCleanupFailed" when the stack isn't then deleted.

A stack being deleted is waited for, and the result is a stack that doesn't exist, where upstream treats it as one to update, which CloudFormation refuses (G.1-D9).

The stack's parameters, the decision to skip the deployment and the template body all depend on the stack as this returns it, which is why it is a step of its own.

func NotificationARNs

func NotificationARNs(arns []string, manage bool, stackARNs []string) ([]string, error)

NotificationARNs returns the SNS topics to notify of a stack's events, or nil to leave the stack's topics as they are: upstream's three states (G.5-D4).

The toolkit manages the stack's topics when manage is set, when arns has a topic, or when the stack's assembly lists its own, even as an empty list; it then sets them to arns followed by the stack's, an empty, non-nil list removing every topic. Otherwise they are left to whoever manages them.

It fails with a cdkerr.Error of Code "InvalidSnsTopicArn" when a topic's ARN isn't an SNS topic's.

func OutputsText

func OutputsText(stackID string, outputs map[string]string) string

OutputsText is the text of the CDK_TOOLKIT_I5901 message that lists a stack's outputs: "Outputs:", then a line "<stack ID>.<key> = <value>" for each output, in the order of their keys, as upstream's is without its colour. It is "" for a stack with no outputs, for which upstream sends no such message.

func StackTags

func StackTags(tags []types.Tag, stackTags map[string]string) []types.Tag

StackTags returns the tags to deploy a stack with: tags when there are any, else the stack's own, sorted by key, as upstream's tagsForStack gives them in its manifest's order. The result is never nil, so that CloudFormation is sent an empty list, which removes the stack's tags, as the CDK CLI sends.

func TerminationProtectionChanged

func TerminationProtectionChanged(deployed *bool, want bool) bool

TerminationProtectionChanged reports whether a stack's termination protection must be updated to want, given its deployed setting, which is off when unknown.

func ValidateSNSTopicARN

func ValidateSNSTopicARN(arn string) bool

ValidateSNSTopicARN reports whether arn is an SNS topic's in any partition, such as aws-cn or aws-us-gov, as upstream's validateSnsTopicArn does since toolkit-lib 1.43.0 (G.5-D6). FIFO topics, whose names end in ".fifo", are rejected, as upstream rejects them.

func ValidationChangeSet

func ValidationChangeSet(ctx context.Context, opts ValidationChangeSetOptions) (_ diagnose.Report, err error)

ValidationChangeSet creates a change set of opts.Template that is never executed, waits for CloudFormation to compute it, has it diagnosed, and always deletes it again, with the stack it created: upstream's createValidationChangeSet, for the validate action's online validation (M.10).

The change set is named cdk-validate-<uuid>, and is an UPDATE when the stack exists, other than as a REVIEW_IN_PROGRESS shell or one being deleted, and a CREATE otherwise, with nested stacks included, as upstream's is. A change set that fails, such as CloudFormation's early validation, isn't an error: the report's diagnosis says what was found, as upstream's waitForReport does.

The cleanup is upstream's validation cleanup, not ChangeSet.Cleanup (M.10-D3): the change set is deleted by its ARN, without waiting, and the stack is deleted, and waited for, only when it didn't exist in any state before, so that a REVIEW_IN_PROGRESS shell someone else left is kept. Each failure is only a warning, as upstream's is. The cleanup runs under context.WithoutCancel on every way out once the change set was created, as cancelled deployments' does (EG-5); a change set CloudFormation is still computing can't be deleted, and is left, with the warning. A host's error from those warnings is joined with the step's error, where upstream's replaces it.

func WriteHotswapCache

func WriteHotswapCache(assemblyDir, stackName, account, region string, root *cfntemplate.Object, nested map[string]cfnstack.NestedStack) error

WriteHotswapCache writes the hotswap template cache for the stack named stackName in an environment, in the cloud assembly directory assemblyDir, after a hotswap deployment: upstream's writeHotswapTemplateCache. root is the root stack's synthesized template, and nested its nested stacks, whose synthesized templates become the cached deployed ones, so that the next hotswap diffs against what this one deployed (M.1-D9).

The file is JSON indented by two spaces with a final newline, as fs-extra's writeJson writes it: {"deployedRootTemplate": ..., "nestedStacks": {<logical ID>: {"physicalName": ..., "deployedTemplate": ..., "nestedStacks": {...}}}}, a nested stack that isn't deployed having no physicalName. Nested stacks are written in the order of their parent's resources, as upstream's object holds them.

Types

type ChangeSet

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

ChangeSet is a change set a deployment prepared, or found, and can execute: the state upstream's FullCloudFormationDeployment keeps between creating a change set and executing it (G.1-D1).

func DescribeExisting

func DescribeExisting(ctx context.Context, t Target, nameOrARN string, templates diagnose.Templates) (*ChangeSet, error)

DescribeExisting describes the change set named nameOrARN, which an earlier command created, maybe not this toolkit, for ChangeSet.Execute: upstream's executeExistingChangeSet.

It doesn't wait for the change set: one still being created, or that failed, or that can't otherwise be executed, fails with its diagnosis' error, because blocking on someone else's change set would be worse than saying it isn't ready. ChangeSet.Cleanup leaves the change set alone, since this deployment didn't create it.

The templates are the ones the change set's description is checked against: the deployed template, as DeployedTemplate reads it, and the stack's, upstream's changeSetTemplates. The caller passes them so that a deployed template it already read, as for the approval of the change set, isn't read again.

func DiffChangeSet

func DiffChangeSet(ctx context.Context, opts DiffChangeSetOptions) (_ *ChangeSet, err error)

DiffChangeSet creates a change set of opts.Template that is never executed, waits for CloudFormation to compute it, and has it checked: upstream's createDiffChangeSet, without its fallback, which is the caller's (J.6-D7).

It returns the change set, whose ChangeSet.Description is as CloudFormation described it, with and without property values, merged, with every page of its changes. The caller deletes it with ChangeSet.Cleanup once it has read what it needs, the change sets CloudFormation created for the stack's nested stacks included, since deleting a change set created with IncludeNestedStacks deletes every change set of its hierarchy; upstream deletes the change set before it describes the nested ones, which then may already be gone (#76). The change set is an UPDATE when the stack exists, other than as a REVIEW_IN_PROGRESS shell or one being deleted, and a CREATE otherwise, with nested stacks included, as upstream's is; a change set of the same name is deleted first when the stack exists, without waiting, as upstream's is. A change set that can't be executed fails with its diagnosis' error, after the warning "Change set <ID> failed: <error>", as upstream's does; a wait cut short by ctx sends no such warning.

On every other way out once the change set was created, DiffChangeSet deletes it itself, with ChangeSet.CleanupOrWarn. Either way it is deleted by ChangeSet.Cleanup, as a deployment's is (G.1-D8), which fixes an upstream defect (J.6-D7, #76): the stack it created is deleted only when no change sets are left on it, where upstream deletes the stack whenever it didn't count as existing, so that a REVIEW_IN_PROGRESS stack holding a change set someone prepared, such as cdk deploy --method=prepare-change-set of a new stack, loses it. A cleanup that fails, as it does for a change set CloudFormation is still computing when ctx is done, is a warning naming what is left, not an error, as a failed deployment's is (G.10-D5).

Resources to import, which upstream's diff reads from migrate.json, arrive with G.13.

func Prepare

func Prepare(ctx context.Context, opts PrepareOptions) (*ChangeSet, error)

Prepare creates the change set that deploys opts.Template to the stack, waits for CloudFormation to compute it, and has it diagnosed: the change-set half of upstream's changeSetDeployment.

Any change set of the same name is deleted first, and waited for, as the CDK CLI does; one that fails to delete fails the deployment (G.1-D5). The change set is an IMPORT when opts.ChangeSet.ResourcesToImport is set, an UPDATE when the stack exists, and a CREATE otherwise, including for a REVIEW_IN_PROGRESS stack.

A change set that can't be executed fails with its diagnosis' error, a cdkerr.KindDeployment error carrying the diagnosis; Prepare then deletes it, and the stack when it was only the change set's (G.1-D8). A change set with no changes is deleted unless opts.NoExecute is set, and the returned change set says so.

Termination protection isn't changed until the change set is executed (G.1-D7).

A stack that describes assets in its metadata, as CDK v1 apps do, fails with a cdkerr.KindToolkit error with Code "LegacyAssetsNotSupported" before anything is sent, because publishing such assets isn't ported; the CDK CLI deploys it (EE-3).

func (*ChangeSet) ARN

func (c *ChangeSet) ARN() string

ARN returns the change set's ARN.

func (*ChangeSet) Cleanup

func (c *ChangeSet) Cleanup(ctx context.Context) error

Cleanup deletes the change set, if this deployment created it and it wasn't executed, and waits for it to go; then, if the stack is a REVIEW_IN_PROGRESS shell with no change sets left, it deletes the stack and waits for that (G.1-D8). It runs to the end even when ctx is cancelled, so that a cancelled deployment leaves nothing behind (EG-5), once CloudFormation has finished computing the change set: one still being created can't be deleted, and Cleanup then fails.

The caller calls it on every way out that leaves the change set unexecuted, such as a declined approval or a result asking for a rollback first; after Execute, or a second time, it does nothing.

func (*ChangeSet) CleanupOrWarn

func (c *ChangeSet) CleanupOrWarn(ctx context.Context) error

CleanupOrWarn deletes the change set as ChangeSet.Cleanup does, and when that fails, as it does for a change set CloudFormation is still computing, warns naming what is left, the change set and, for a new stack, the REVIEW_IN_PROGRESS stack it created, rather than failing, as a failed deployment's cleanup warns (G.10-D5). It returns only a host's error from the warning.

func (*ChangeSet) Description

Description returns the change set as CloudFormation described it, with every page of its changes.

func (*ChangeSet) EnableRollback

func (c *ChangeSet) EnableRollback()

EnableRollback has the next ChangeSet.Execute roll back on failure, for the change set Execute returned as *ReplacementRequiresRollback, so that the change set approved is the one executed (K.3-D5). For a standard change set, rollback is a parameter of ExecuteChangeSet, not of the change set, so the change set needs nothing else; an express one's can't be changed, as ChangeSet.RollbackFixed reports, and EnableRollback doesn't change whether it rolls back.

func (*ChangeSet) Execute

func (c *ChangeSet) Execute(ctx context.Context) (Result, error)

Execute executes the change set, and monitors and waits for the deployment: upstream's checkAndExecuteChangeSet and monitorDeployment.

Whether it rolls back is the change set's own setting for an express change set, which is fixed when it is created, and otherwise the deployment's Rollback, where only RollbackDisabled turns it off, as upstream reads it. It executes nothing, and:

  • fails with a cdkerr.KindToolkit error with Code "ExpressStackFailPaused", upstream's, when the stack is UPDATE_FAILED after an express deployment and the change set would roll back or replaces a resource, which CloudFormation refuses on such a stack, whatever mode the deployment asks for;
  • outside express mode, returns *NeedsRollbackFirst for a stack paused in a failed state (CREATE_FAILED, UPDATE_FAILED or UPDATE_ROLLBACK_FAILED) unless the change set doesn't roll back and replaces nothing;
  • in either mode, returns *ReplacementRequiresRollback for a change set that replaces a resource and doesn't roll back.

Replacements are those of the stack's own resources; one inside a nested stack isn't seen (G.1-D9).

It sets the stack's termination protection just before executing (G.1-D7). A change set with no changes isn't executed: only the termination protection is set, and the result is a no-op.

A deployment that fails is diagnosed: the error is the diagnosis' when it finds the problem, a cdkerr.KindDeployment error carrying it, and otherwise the deployment's. Waiting is bounded by ctx, not by a timeout.

func (*ChangeSet) HasNoChanges

func (c *ChangeSet) HasNoChanges() bool

HasNoChanges reports whether the change set would change nothing. Prepare has then deleted it, unless the deployment won't execute it.

func (*ChangeSet) RollbackFixed

func (c *ChangeSet) RollbackFixed() bool

RollbackFixed reports whether the change set's rollback setting was fixed when it was created, as an express-mode change set's is, which ExecuteChangeSet can't change: rolling back then needs a new change set, created with rollback enabled.

func (*ChangeSet) StackARN

func (c *ChangeSet) StackARN() string

StackARN returns the ARN of the change set's stack.

func (*ChangeSet) Unexecuted

func (c *ChangeSet) Unexecuted() *Deployed

Unexecuted returns the result of a deployment that leaves the change set unexecuted, as with NoExecute: no change, with the stack as it was, and the change set unless it has no changes.

type ChangeSetOptions

type ChangeSetOptions struct {
	// Name is the change set's name; empty means [DefaultChangeSetName].
	Name string

	// ImportExistingResources has CloudFormation import resources that already exist, rather than fail to create them.
	ImportExistingResources bool

	// RevertDrift has CloudFormation bring resources that drifted back to the template.
	RevertDrift bool

	// ResourcesToImport, when set, makes the change set an import of these resources.
	ResourcesToImport []types.ResourceToImport
}

ChangeSetOptions are the options for the change set Prepare creates (G.1-D3).

type CloudFormation

type CloudFormation interface {
	cfnstack.CloudFormation
	diagnose.CloudFormation
	CreateStack(ctx context.Context, in *cloudformation.CreateStackInput, opts ...func(*cloudformation.Options)) (*cloudformation.CreateStackOutput, error)
	UpdateStack(ctx context.Context, in *cloudformation.UpdateStackInput, opts ...func(*cloudformation.Options)) (*cloudformation.UpdateStackOutput, error)
	CreateChangeSet(ctx context.Context, in *cloudformation.CreateChangeSetInput, opts ...func(*cloudformation.Options)) (*cloudformation.CreateChangeSetOutput, error)
	ExecuteChangeSet(ctx context.Context, in *cloudformation.ExecuteChangeSetInput, opts ...func(*cloudformation.Options)) (*cloudformation.ExecuteChangeSetOutput, error)
	DeleteChangeSet(ctx context.Context, in *cloudformation.DeleteChangeSetInput, opts ...func(*cloudformation.Options)) (*cloudformation.DeleteChangeSetOutput, error)
	RollbackStack(ctx context.Context, in *cloudformation.RollbackStackInput, opts ...func(*cloudformation.Options)) (*cloudformation.RollbackStackOutput, error)
	ContinueUpdateRollback(ctx context.Context, in *cloudformation.ContinueUpdateRollbackInput, opts ...func(*cloudformation.Options)) (*cloudformation.ContinueUpdateRollbackOutput, error)
	DeleteStack(ctx context.Context, in *cloudformation.DeleteStackInput, opts ...func(*cloudformation.Options)) (*cloudformation.DeleteStackOutput, error)
	UpdateTerminationProtection(ctx context.Context, in *cloudformation.UpdateTerminationProtectionInput, opts ...func(*cloudformation.Options)) (*cloudformation.UpdateTerminationProtectionOutput, error)
}

CloudFormation is the part of the CloudFormation API a deployment uses.

type Deployed

type Deployed struct {
	// NoOp says nothing changed.
	NoOp bool

	// StackARN is the stack's ARN.
	StackARN string

	// Outputs are the stack's outputs, by key, as deployed; for a result that changed nothing, such as a no-op or an unexecuted change set, they are the stack's from before the deployment, as upstream's are, and an outputs file records them (G.11).
	// A nested stack's outputs aren't included.
	Outputs map[string]string

	// ChangeSet is the change set, when it was prepared and not executed.
	ChangeSet *cloudformation.DescribeChangeSetOutput

	// DeleteFailures are the resources that failed to delete during an update, which CloudFormation skipped.
	DeleteFailures []stackevents.DeleteFailure

	// StabilizingResources are the resources that express mode reported complete while they were still settling.
	StabilizingResources []stackevents.StabilizingResource
}

Deployed is a stack deployed, or left as it was: upstream's SuccessfulDeployStackResult.

func CanSkip

func CanSkip(ctx context.Context, opts PrepareOptions, template *cfntemplate.Object, params ParameterValues, skipOpts SkipOptions) (*Deployed, error)

CanSkip returns the result of a deployment that would change nothing, or nil when the deployment must go ahead: upstream's canSkipDeploy, with the debug messages of deployStack around it (G.6).

opts are the options Prepare will be given, or, for Direct, its target and inputs, except Template, which is built only when the deployment goes ahead; template is the template to deploy, read with cfntemplate.ReadTemplateFile so that its key order is the file's; and params are the parameters opts.Parameters came from (G.6-D1). The caller calls it after Lookup and resolving the parameters, and before building the template body and publishing it, as upstream's deployStack does.

It refuses to skip, in upstream's order, a deployment that is forced, that won't execute its change set, that reverts drift, or of a stack that doesn't exist; then one whose template, tags, notification ARNs, termination protection or parameters differ from the stack's, or whose parameters come from SSM; then one of a stack in a failed state. Last, as upstream's canSkipDeploy does for every caller, it refuses one whose template differs by cfndiff.DiffTemplate from the root template of the CDK CLI's hotswap template cache for the stack in skipOpts.Environment, since a hotswap left the stack's resources other than its template in CloudFormation says (M.1-D8); the cache is read only once every other check has passed, and only when opts.Artifact is set, from its assembly's directory, and a cache that can't be read is none. The only call it makes is GetTemplate, once the checks before need it. A skip is a no-op with the stack's ARN and outputs.

It runs before the change set is prepared, and opts.NoExecute means only that the caller won't execute it, so an unchanged deployment through a change set is skipped, as upstream's is since toolkit-lib 1.43.0.

It departs from upstream in two places:

  • nil NotificationARNs, which leave the stack's as they are, aren't compared, where upstream compares them as none (G.6-D3);
  • a REVIEW_IN_PROGRESS stack counts as no stack, so its template isn't read, where upstream reads it (G.6-D4).

type DestroyOptions

type DestroyOptions struct {
	// CFN is the CloudFormation client of the stack's environment, with the credentials to delete it.
	CFN CloudFormation

	// IO is where the deletion sends its messages.
	IO *iohelper.Helper

	// Artifact is the stack's cloud assembly artifact, whose metadata names each event's construct; it may be nil.
	Artifact *cloudassembly.Stack

	// Name is the name the stack is deployed as.
	Name string

	// RoleARN is the role CloudFormation deletes the stack with, its placeholders replaced; empty leaves it out, so that the stack's role is used.
	RoleARN string

	// Express deletes the stack in express mode.
	Express bool

	// PollingInterval is how long to wait between reads of the stack's events, and of its status; zero means each one's default, 2 s and 5 s.
	PollingInterval time.Duration
}

DestroyOptions are the options for Destroy, resolved by the caller, as G.1-D2 has a deployment's (G.8-D2).

type Destroyed

type Destroyed struct {
	// StackARN is the stack's ARN, or empty when the stack didn't exist.
	StackARN string

	// StabilizingResources are the resources that express mode reported deleted while they were still tearing down.
	StabilizingResources []stackevents.StabilizingResource
}

Destroyed is a stack Destroy deleted, or found not to exist: upstream's DestroyStackResult.

func Destroy

func Destroy(ctx context.Context, opts DestroyOptions) (*Destroyed, error)

Destroy deletes the stack and waits for it to go: upstream's destroyStack (G.8). The caller has accessed the environment for mutation and resolved the role, as upstream's Deployments.destroyStack does first.

A stack that doesn't exist isn't touched, and the result has no ARN. One that does, REVIEW_IN_PROGRESS included, is deleted by its ARN, its events monitored from the local clock's time before the request, as upstream's are.

A deletion that fails, leaving the stack DELETE_FAILED or in any other status but deleted, fails with a cdkerr.KindDeployment error with upstream's message, the resources' failures appended, and DeploymentCode the root cause's error code, or "StackDestroyFailed". Any other error is returned as it is, where upstream wraps every error as a failed deletion (G.8-D3): a refused DeleteStack, such as for a stack with termination protection, is the API's error, which errors.As finds as a smithy.APIError, and a cancelled wait wraps ctx's error, with the deletion left running in CloudFormation (G.10-D1). The request is sent whole once begun (G.10-D4).

type DiffChangeSetOptions

type DiffChangeSetOptions struct {
	// Target is the stack: its CFN, through the deploy role, IO, Deployed, as [cfnstack.Lookup] returned it, without deleting a failed creation, Artifact, Diagnoser and PollingInterval, which bounds the waits of the cleanup.
	// Its other fields aren't used, since the change set is never executed.
	Target

	// StackInputs are the change set's Template, published already if it was uploaded, Parameters, Tags and RoleARN; its NotificationARNs aren't sent, as upstream's aren't.
	StackInputs

	// Name is the change set's name; empty means cdk-diff-change-set-<uuid>.
	Name string

	// ImportExistingResources has CloudFormation import resources that already exist, rather than fail to create them.
	ImportExistingResources bool

	// Templates are the deployed template the diff compares against, upstream's deployedTemplate, and the stack's template, which the change set's description is checked against, so that a description that would hide a difference between them is completed.
	Templates diagnose.Templates
}

DiffChangeSetOptions are the options for DiffChangeSet.

type DirectOptions

type DirectOptions struct {
	Target
	StackInputs
}

DirectOptions are the options for Direct.

type HotswapCache

type HotswapCache struct {
	// Root is the root stack's template, as the last hotswap deployment left it; nil when the cache holds none.
	Root *cfntemplate.Object

	// Nested are the CDK-managed nested stacks of the root stack's synthesized template that the cache holds, at every depth, by logical ID: each with its physical name and deployed template from the cache, and its synthesized template read from the assembly.
	Nested map[string]cfnstack.NestedStack
}

HotswapCache is what the hotswap template cache holds for a stack in an environment: the templates the last hotswap deployment left deployed, which the next one diffs against in place of the stack's templates in CloudFormation: upstream's RootTemplateWithNestedStacks, read from the cache.

func ReadHotswapCache

func ReadHotswapCache(assemblyDir, stackName, account, region string, generated *cfntemplate.Object) *HotswapCache

ReadHotswapCache returns the hotswap template cache for the stack named stackName in an environment, in the cloud assembly directory assemblyDir, or nil when there is none: upstream's readHotswapTemplateCache. generated is the root stack's synthesized template.

Only the nested stacks the cache holds are returned, each found as a CDK-managed nested stack of its parent's synthesized template, a resource of type AWS::CloudFormation::Stack whose metadata names its template in the assembly as "aws:asset:path", and its synthesized template read fresh from the assembly; a nested stack the cache doesn't hold is left out, so that the diff sees it as a resource added. A cache that can't be read, or whose nested stacks' templates can't be, is no cache, as upstream's catch makes it.

type NeedsRollbackFirst

type NeedsRollbackFirst struct {
	Reason NeedsRollbackReason

	// Status is the stack's status.
	Status string
}

NeedsRollbackFirst is a stack paused in a failed state, which must be rolled back before the change set can be executed: upstream's failpaused-need-rollback-first.

type NeedsRollbackReason

type NeedsRollbackReason string

NeedsRollbackReason is why a stack must be rolled back before it is deployed.

const (
	// NeedsRollbackForReplacement means the change set replaces a resource, which a stack paused in a failed state can't do.
	NeedsRollbackForReplacement NeedsRollbackReason = "replacement"

	// NeedsRollbackForRollback means the deployment would roll back on failure, which a stack paused in a failed state can't do until it is rolled back.
	NeedsRollbackForRollback NeedsRollbackReason = "not-norollback"
)

type OutputsFile

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

OutputsFile collects the outputs of the stacks a deployment deploys, and writes them in the format of upstream's outputs file (G.11-D1). It is safe for concurrent use.

The deploy action makes one once it has selected its stacks, adds each stack's outputs as it deploys, and writes it once, when it returns, however it returns (G.11-D3).

func NewOutputsFile

func NewOutputsFile(path string) *OutputsFile

NewOutputsFile returns an OutputsFile that writes to path.

func (*OutputsFile) Add

func (f *OutputsFile) Add(stackName string, outputs map[string]string)

Add records the outputs of the stack named stackName, its CloudFormation name, replacing any recorded for it before. A stack with no outputs is left out of the file, as upstream leaves it out.

func (*OutputsFile) Write

func (f *OutputsFile) Write() error

Write writes the outputs recorded so far, replacing the file, as upstream's writeJson does: an object of stack names to objects of output keys to values, as JSON.stringify writes it with two-space indentation, and a final newline. With no outputs recorded, it writes {}.

Stacks are written in the order of their names, and each stack's outputs in the order of their keys, so that the same deployment writes the same bytes, where upstream writes them in the order the stacks finished and CloudFormation returned the outputs (G.11-D5). An output key of digits only comes first, as JavaScript orders it. Missing parent directories are created, and the file is written in place, keeping a symbolic link and an existing file's mode (G.11-D7).

It fails with a cdkerr.KindToolkit error with Code "OutputsFileWriteFailed", wrapping the file system's error.

type ParameterChanges

type ParameterChanges int

ParameterChanges says whether a deployment's parameters change a stack's: upstream's ParameterChanges.

const (
	// ParametersUnchanged means every value is the deployed one.
	ParametersUnchanged ParameterChanges = iota

	// ParametersChanged means a value differs from the deployed one, or a parameter is added or removed.
	ParametersChanged

	// ParametersFromSSM means a parameter's value is read from SSM, so whether it changed can't be known, and the stack is deployed anyway.
	// A parameter whose description contains "[cdk:skip]" is taken as unchanged.
	ParametersFromSSM
)

type ParameterValues

type ParameterValues struct {
	// Values are every parameter's value, from those given, the deployed values and the template's defaults.
	Values map[string]string

	// API is what to send CloudFormation: the template's parameters in its order, a deployed value as UsePreviousValue, a default not at all, then the values given for parameters the template doesn't declare, so that CloudFormation names them.
	API []types.Parameter
	// contains filtered or unexported fields
}

ParameterValues are the parameters to deploy a stack with: upstream's ParameterValues.

func (ParameterValues) Changes

func (p ParameterValues) Changes(deployed map[string]string) ParameterChanges

Changes reports whether p changes the deployed parameter values: upstream's hasChanges.

type PrepareOptions

type PrepareOptions struct {
	Target
	StackInputs

	// ChangeSet are the change set's options.
	ChangeSet ChangeSetOptions

	// NoExecute says the change set won't be executed: it is announced as waiting for someone to execute it, and kept even when it has no changes.
	NoExecute bool

	// Force says the deployment was forced, for the warning when the change set has no changes.
	Force bool
}

PrepareOptions are the options for Prepare.

type ReplacementRequiresRollback

type ReplacementRequiresRollback struct{}

ReplacementRequiresRollback is a change set that replaces a resource, in a deployment that wouldn't roll back: upstream's replacement-requires-rollback. The deployment must roll back for the replacement to be safe.

type Result

type Result interface {
	// contains filtered or unexported methods
}

Result is the outcome of ChangeSet.Execute: *Deployed, *NeedsRollbackFirst or *ReplacementRequiresRollback.

func Direct

func Direct(ctx context.Context, opts DirectOptions) (Result, error)

Direct deploys opts.Template by CreateStack or UpdateStack, and monitors and waits for the deployment: upstream's directDeployment (G.2). It is the step after Lookup that takes the place of Prepare and ChangeSet.Execute, with nothing to approve between them and nothing to clean up.

The stack is created when it doesn't exist, and updated otherwise; an update that changes nothing is a no-op with the stack's outputs, as upstream's is. A REVIEW_IN_PROGRESS stack, the shell an unexecuted change set leaves, is deleted first when it holds no change sets, and then created; one that holds change sets fails with a cdkerr.KindDeployment error with DeploymentCode "StackHasPendingChangeSets", naming them, since they may be someone else's (G.2-D3). Upstream sends CreateStack for such a stack, which CloudFormation refuses.

Outside express mode, a stack paused in a failed state (CREATE_FAILED, UPDATE_FAILED or UPDATE_ROLLBACK_FAILED) is returned as *NeedsRollbackFirst before anything is sent, when the deployment would roll back, which CloudFormation refuses for such a stack (G.2-D2); upstream sends UpdateStack and fails. Without a change set, a replacement can't be seen, so Direct never returns *ReplacementRequiresRollback, and a paused stack with rollback disabled is updated, as upstream's is.

A new stack is created with its termination protection; an existing one has it set just before the update, as upstream does. The events of a new stack are all reported, since every one of them is this deployment's; those of an update are reported from when Direct started, by the local clock, as upstream does (G.2-D5). A deployment that fails is diagnosed as ChangeSet.Execute's is.

A stack that describes assets in its metadata, as CDK v1 apps do, fails with a cdkerr.KindToolkit error with Code "LegacyAssetsNotSupported", as Prepare does (EE-3).

type Rollback

type Rollback int

Rollback is whether a failed deployment rolls back (G.1-D4).

const (
	// RollbackDefault rolls back, except in express mode, where CloudFormation doesn't unless told to.
	RollbackDefault Rollback = iota

	// RollbackEnabled rolls back, in express mode too.
	RollbackEnabled

	// RollbackDisabled leaves the stack as the failure left it.
	RollbackDisabled
)

type RollbackStackOptions

type RollbackStackOptions struct {
	// CFN is the CloudFormation client of the stack's environment, with the credentials to roll it back.
	CFN CloudFormation

	// IO is where the rollback sends its messages.
	IO *iohelper.Helper

	// StackName is the name the stack is deployed as.
	StackName string

	// Artifact is the stack's cloud assembly artifact, whose metadata names each event's construct; it may be nil.
	Artifact *cloudassembly.Stack

	// RoleARN is the role CloudFormation rolls back with, its placeholders replaced; empty leaves it out, so that the stack's role is used.
	RoleARN string

	// OrphanFailedResources has a continued rollback skip the resources that fail it, by sending ForceRollback, which leaves CloudFormation to pick them, nested stacks' included: upstream's orphanFailedResources and the CLI's --force.
	OrphanFailedResources bool

	// OrphanLogicalIDs are the logical IDs of resources a continued rollback skips, upstream's orphanLogicalIds and the CLI's --orphan; a nested stack's resource is <nested stack name>.<logical ID>, as CloudFormation takes it.
	OrphanLogicalIDs []string

	// PollingInterval is how long to wait between reads of the stack's events, and of its status; zero means each one's default, 2 s and 5 s.
	PollingInterval time.Duration
}

RollbackStackOptions are the options for RollbackStack (G.7-D1).

type RolledBack

type RolledBack struct {
	// StackARN is the stack's ARN, or empty when the stack doesn't exist.
	StackARN string

	// NotRollbackable says the stack's status called for no rollback, or was ROLLBACK_FAILED, from which a stack can't be rolled back, so nothing was sent.
	NotRollbackable bool
}

RolledBack is what came of RollbackStack: upstream's RollbackStackResult.

func RollbackStack

func RollbackStack(ctx context.Context, opts RollbackStackOptions) (*RolledBack, error)

RollbackStack rolls back a stack that a failed deployment left paused, or whose rollback failed: upstream's Deployments.rollbackStack (G.7). The caller has accessed the environment for mutation and checked the bootstrap stack's version, as upstream's rollbackStack does first.

It looks the stack up and, by its status, starts a rollback with RollbackStack (CREATE_FAILED, UPDATE_FAILED) or continues one with ContinueUpdateRollback (UPDATE_ROLLBACK_FAILED), skipping opts.OrphanLogicalIDs, or, with opts.OrphanFailedResources, sending ForceRollback, so that CloudFormation skips the resources whose rollback failed; then it monitors the stack's events and waits for the stack. After a forced pass it warns which resources CloudFormation skipped, by their logical IDs, a nested stack's qualified by its parents', as <parent logical ID>.<logical ID>, as upstream does. With opts.OrphanFailedResources it continues again while the rollback fails, up to ten passes in all, then fails with a cdkerr.KindToolkit error with Code "RollbackStalled". A stack in any other status, one that doesn't exist included, isn't rolled back: the result says it is not rollbackable, with a warning.

A rollback that doesn't end ROLLBACK_COMPLETE or UPDATE_ROLLBACK_COMPLETE fails with a cdkerr.KindDeployment error whose message is the resources' failures, or the stack's status, with upstream's advice, and whose DeploymentCode is the root cause's error code, or "RollbackFailed". A cancelled wait returns an error wrapping ctx's, not a deployment error, and the rollback carries on in CloudFormation (G.10-D1, G.10-D2); the requests that start or continue a rollback are sent whole once begun (G.10-D4).

It departs from upstream in five places:

  • success is the stack's final status, where upstream counts a rollback the monitor saw no failure of as a success, whatever status it ends in (G.7-D2);
  • the events are read from the local clock before the request, where upstream reads them from after it, losing the first (G.7-D3);
  • a forced pass that skipped nothing and still failed isn't followed by another, and the rollback fails with its error, where upstream sends the same request nine more times (G.7-D4, as revised); what it skipped is read from the events the monitor read, so a pass whose skip events it missed, because a read of them failed (CDK_TOOLKIT_E5500, CDK_TOOLKIT_W5500) or a nested stack's events weren't read yet, counts as one that skipped nothing, and the rollback stops though another pass might have finished it;
  • opts.OrphanLogicalIDs given for a stack that must be rolled back first are skipped in a continued rollback if the first ends UPDATE_ROLLBACK_FAILED, where upstream ignores them (G.7-D5);
  • a stack that doesn't exist is not rollbackable, where upstream fails (G.7-D6).

type SkipOptions

type SkipOptions struct {
	// Environment is the stack's environment, resolved, whose hotswap template cache in the assembly's directory is read; its zero value reads none.
	Environment cloudassembly.Environment

	// Hotswap says the deployment is a hotswap one, whose skip also says, at info level, that no hotswap happened, as upstream's does.
	Hotswap bool
}

SkipOptions are what CanSkip reads beyond a deployment's options.

type StackInputs

type StackInputs struct {
	// Template is the template to deploy, from [cfnstack.BodyParameter], published already if it was uploaded.
	Template cfnstack.TemplateBody

	// Parameters are the stack's parameters, as [ParameterValues] gives them to send.
	Parameters []types.Parameter

	// Tags are the stack's tags, from [StackTags].
	Tags []types.Tag

	// NotificationARNs are the stack's notification topics, from [NotificationARNs]; nil leaves them as they are.
	NotificationARNs []string

	// RoleARN is the role CloudFormation deploys the stack with; empty means the stack's, or the caller's credentials.
	RoleARN string
}

StackInputs are what a deployment sends CloudFormation for the stack, whichever way it deploys: upstream's commonPrepareOptions (G.2-D1).

type StackParameters

type StackParameters struct {
	// Values are the values to set, keyed by "Param" for every stack, or "Stack:Param" for the stack named Stack, whose values override those for every stack.
	Values map[string]string

	// ReplaceExisting drops the deployed values of the parameters Values doesn't set, so that they take the template's defaults.
	ReplaceExisting bool
}

StackParameters are the parameter values a deployment sets, and what happens to the parameters it doesn't set: upstream's StackParameters, which K.3 makes public (G.5-D3).

The zero value keeps every parameter's deployed value, upstream's StackParameters.onlyExisting(), which upstream documents as the default and the CDK CLI uses, though upstream's library replaces them when no parameters are given (G.5-D2). Values alone is upstream's withExisting, and Values with ReplaceExisting is its exactly.

func (StackParameters) Resolve

func (p StackParameters) Resolve(t TemplateParameters, stackName string, extra, deployed map[string]string) (ParameterValues, error)

Resolve returns the parameters to deploy the named stack with, from its template's parameters t: the values p sets for it, overridden by extra, such as its legacy assets' parameters; then, unless p.ReplaceExisting, the deployed values; then the template's defaults. It fails as TemplateParameters.SupplyAll does.

type Target

type Target struct {
	// CFN is the CloudFormation client of the stack's environment, with the credentials to deploy it.
	CFN CloudFormation

	// IO is where the deployment sends its messages.
	IO *iohelper.Helper

	// Deployed is the stack as [Lookup] returned it; its Name is the name the stack is deployed as.
	Deployed *cfnstack.Stack

	// Artifact is the stack's cloud assembly artifact, whose metadata names each event's construct, and whose template a change set's description is checked against; it may be nil, and then the description isn't checked.
	Artifact *cloudassembly.Stack

	// TerminationProtection is whether the stack should have termination protection.
	// It is set when the change set is executed.
	TerminationProtection bool

	// Diagnoser diagnoses a change set that can't be executed and a deployment that failed.
	Diagnoser *diagnose.Diagnoser

	// PollingInterval is how long to wait between reads of the stack's events, and of its status; zero means each one's default, 2 s and 5 s.
	PollingInterval time.Duration

	// Express deploys in CloudFormation's express mode.
	Express bool

	// Rollback is whether a failed deployment rolls back.
	Rollback Rollback
}

Target is the stack a deployment acts on, and how.

type TemplateParameters

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

TemplateParameters are the parameters a template declares: upstream's TemplateParameters.

func NewTemplateParameters

func NewTemplateParameters(template *cfntemplate.Object) TemplateParameters

NewTemplateParameters returns the parameters template declares.

func (TemplateParameters) Declares

func (t TemplateParameters) Declares(name string) bool

Declares reports whether the template declares the named parameter.

func (TemplateParameters) SupplyAll

func (t TemplateParameters) SupplyAll(values map[string]string) (ParameterValues, error)

SupplyAll returns the template's parameters with the given values, or else their defaults: upstream's supplyAll. A missing key in values means no value is given; the empty string is a value.

It fails with a cdkerr.Error of Code "MissingParameters" when a parameter has neither.

func (TemplateParameters) UpdateExisting

func (t TemplateParameters) UpdateExisting(values, deployed map[string]string) (ParameterValues, error)

UpdateExisting returns the template's parameters with the given values, or else their deployed values, sent as UsePreviousValue, or else their defaults: upstream's updateExisting.

It fails as TemplateParameters.SupplyAll does.

type ValidationChangeSetOptions

type ValidationChangeSetOptions struct {
	// Target is the stack: its CFN, IO, Deployed, as [cfnstack.Lookup] returned it, without deleting a failed creation, whose template the change set's description is checked against, Diagnoser and PollingInterval, which bounds the wait for a stack the change set created to be deleted.
	// Its other fields aren't used, since the change set is never executed.
	Target

	// StackInputs are the change set's Template, published already if it was uploaded, Parameters, Tags and RoleARN; its NotificationARNs aren't sent, as upstream's aren't.
	StackInputs

	// Generated is the stack's template, which the change set's description is checked against with Deployed's template, as [DeployedTemplate] reads it: upstream's options.stack.template.
	// Nil is an empty template.
	Generated *cfntemplate.Object
}

ValidationChangeSetOptions are the options for ValidationChangeSet.

Jump to

Keyboard shortcuts

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