Skip to content

Commit a02f0d7

Browse files
author
awstools
committed
feat(client-cloudformation): Specify desired CloudFormation behavior in the event of ChangeSet execution failure using the CreateChangeSet OnStackFailure parameter
1 parent 880a917 commit a02f0d7

File tree

5 files changed

+133
-3
lines changed

5 files changed

+133
-3
lines changed

clients/client-cloudformation/src/commands/CreateChangeSetCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export interface CreateChangeSetCommandOutput extends CreateChangeSetOutput, __M
110110
* },
111111
* ],
112112
* IncludeNestedStacks: true || false,
113+
* OnStackFailure: "DO_NOTHING" || "ROLLBACK" || "DELETE",
113114
* };
114115
* const command = new CreateChangeSetCommand(input);
115116
* const response = await client.send(command);

clients/client-cloudformation/src/commands/DescribeChangeSetCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export interface DescribeChangeSetCommandOutput extends DescribeChangeSetOutput,
128128
* // IncludeNestedStacks: true || false,
129129
* // ParentChangeSetId: "STRING_VALUE",
130130
* // RootChangeSetId: "STRING_VALUE",
131+
* // OnStackFailure: "DO_NOTHING" || "ROLLBACK" || "DELETE",
131132
* // };
132133
*
133134
* ```

clients/client-cloudformation/src/models/models_0.ts

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,21 @@ export interface ContinueUpdateRollbackInput {
14021402
*/
14031403
export interface ContinueUpdateRollbackOutput {}
14041404

1405+
/**
1406+
* @public
1407+
* @enum
1408+
*/
1409+
export const OnStackFailure = {
1410+
DELETE: "DELETE",
1411+
DO_NOTHING: "DO_NOTHING",
1412+
ROLLBACK: "ROLLBACK",
1413+
} as const;
1414+
1415+
/**
1416+
* @public
1417+
*/
1418+
export type OnStackFailure = (typeof OnStackFailure)[keyof typeof OnStackFailure];
1419+
14051420
/**
14061421
* @public
14071422
* <p>The Parameter data type.</p>
@@ -1762,6 +1777,36 @@ export interface CreateChangeSetInput {
17621777
* set to <code>False</code>. To include nested sets in a change set, specify <code>True</code>.</p>
17631778
*/
17641779
IncludeNestedStacks?: boolean;
1780+
1781+
/**
1782+
* <p>Determines what action will be taken if stack creation fails. If this parameter is specified, the
1783+
* <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API operation must not
1784+
* be specified. This must be one of these values:</p>
1785+
* <ul>
1786+
* <li>
1787+
* <p>
1788+
* <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the
1789+
* <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status
1790+
* of the stack is <code>DELETE_FAILED</code>.</p>
1791+
* </li>
1792+
* <li>
1793+
* <p>
1794+
* <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying
1795+
* <code>true</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
1796+
* operation.</p>
1797+
* </li>
1798+
* <li>
1799+
* <p>
1800+
* <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying
1801+
* <code>false</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
1802+
* operation.</p>
1803+
* </li>
1804+
* </ul>
1805+
* <p>For nested stacks, when the <code>OnStackFailure</code> parameter is set to <code>DELETE</code> for the change
1806+
* set for the parent stack, any failure in a child stack will cause the parent stack creation to fail and all stacks to
1807+
* be deleted.</p>
1808+
*/
1809+
OnStackFailure?: OnStackFailure | string;
17651810
}
17661811

17671812
/**
@@ -3219,6 +3264,33 @@ export interface DescribeChangeSetOutput {
32193264
* <p>Specifies the change set ID of the root change set in the current nested change set hierarchy.</p>
32203265
*/
32213266
RootChangeSetId?: string;
3267+
3268+
/**
3269+
* <p>Determines what action will be taken if stack creation fails. When this parameter is specified, the
3270+
* <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API operation must not
3271+
* be specified. This must be one of these values:</p>
3272+
* <ul>
3273+
* <li>
3274+
* <p>
3275+
* <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the
3276+
* <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status
3277+
* of the stack is <code>DELETE_FAILED</code>.</p>
3278+
* </li>
3279+
* <li>
3280+
* <p>
3281+
* <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying
3282+
* <code>true</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
3283+
* operation.</p>
3284+
* </li>
3285+
* <li>
3286+
* <p>
3287+
* <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying
3288+
* <code>false</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
3289+
* operation.</p>
3290+
* </li>
3291+
* </ul>
3292+
*/
3293+
OnStackFailure?: OnStackFailure | string;
32223294
}
32233295

32243296
/**
@@ -5998,7 +6070,22 @@ export interface ExecuteChangeSetInput {
59986070
ClientRequestToken?: string;
59996071

60006072
/**
6001-
* <p>Preserves the state of previously provisioned resources when an operation fails.</p>
6073+
* <p>Preserves the state of previously provisioned resources when an operation
6074+
* fails. This parameter can't be specified when
6075+
* the <code>OnStackFailure</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html">CreateChangeSet</a> API operation was
6076+
* specified.</p>
6077+
* <ul>
6078+
* <li>
6079+
* <p>
6080+
* <code>True</code> - if the stack creation fails, do nothing. This is equivalent to specifying
6081+
* <code>DO_NOTHING</code> for the <code>OnStackFailure</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html">CreateChangeSet</a> API operation.</p>
6082+
* </li>
6083+
* <li>
6084+
* <p>
6085+
* <code>False</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying
6086+
* <code>ROLLBACK</code> for the <code>OnStackFailure</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html">CreateChangeSet</a> API operation.</p>
6087+
* </li>
6088+
* </ul>
60026089
* <p>Default: <code>True</code>
60036090
* </p>
60046091
*/

clients/client-cloudformation/src/protocols/Aws_query.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5392,6 +5392,9 @@ const se_CreateChangeSetInput = (input: CreateChangeSetInput, context: __SerdeCo
53925392
if (input.IncludeNestedStacks != null) {
53935393
entries["IncludeNestedStacks"] = input.IncludeNestedStacks;
53945394
}
5395+
if (input.OnStackFailure != null) {
5396+
entries["OnStackFailure"] = input.OnStackFailure;
5397+
}
53955398
return entries;
53965399
};
53975400

@@ -8281,6 +8284,9 @@ const de_DescribeChangeSetOutput = (output: any, context: __SerdeContext): Descr
82818284
if (output["RootChangeSetId"] !== undefined) {
82828285
contents.RootChangeSetId = __expectString(output["RootChangeSetId"]);
82838286
}
8287+
if (output["OnStackFailure"] !== undefined) {
8288+
contents.OnStackFailure = __expectString(output["OnStackFailure"]);
8289+
}
82848290
return contents;
82858291
};
82868292

@@ -11113,7 +11119,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
1111311119
ignoreDeclaration: true,
1111411120
parseTagValue: false,
1111511121
trimValues: false,
11116-
tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
11122+
tagValueProcessor: (_: any, val: any) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
1111711123
});
1111811124
parser.addEntity("#xD", "\r");
1111911125
parser.addEntity("#10", "\n");

codegen/sdk-codegen/aws-models/cloudformation.json

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2543,6 +2543,12 @@
25432543
"traits": {
25442544
"smithy.api#documentation": "<p>Creates a change set for the all nested stacks specified in the template. The default behavior of this action is\n set to <code>False</code>. To include nested sets in a change set, specify <code>True</code>.</p>"
25452545
}
2546+
},
2547+
"OnStackFailure": {
2548+
"target": "com.amazonaws.cloudformation#OnStackFailure",
2549+
"traits": {
2550+
"smithy.api#documentation": "<p>Determines what action will be taken if stack creation fails. If this parameter is specified, the\n <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API operation must not\n be specified. This must be one of these values:</p>\n <ul>\n <li>\n <p>\n <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the\n <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status\n of the stack is <code>DELETE_FAILED</code>.</p>\n </li>\n <li>\n <p>\n <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying\n <code>true</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n <li>\n <p>\n <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying\n <code>false</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n </ul>\n <p>For nested stacks, when the <code>OnStackFailure</code> parameter is set to <code>DELETE</code> for the change\n set for the parent stack, any failure in a child stack will cause the parent stack creation to fail and all stacks to\n be deleted.</p>"
2551+
}
25462552
}
25472553
},
25482554
"traits": {
@@ -3785,6 +3791,12 @@
37853791
"traits": {
37863792
"smithy.api#documentation": "<p>Specifies the change set ID of the root change set in the current nested change set hierarchy.</p>"
37873793
}
3794+
},
3795+
"OnStackFailure": {
3796+
"target": "com.amazonaws.cloudformation#OnStackFailure",
3797+
"traits": {
3798+
"smithy.api#documentation": "<p>Determines what action will be taken if stack creation fails. When this parameter is specified, the\n <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API operation must not\n be specified. This must be one of these values:</p>\n <ul>\n <li>\n <p>\n <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the\n <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status\n of the stack is <code>DELETE_FAILED</code>.</p>\n </li>\n <li>\n <p>\n <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying\n <code>true</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n <li>\n <p>\n <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying\n <code>false</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n </ul>"
3799+
}
37883800
}
37893801
},
37903802
"traits": {
@@ -5507,7 +5519,7 @@
55075519
"DisableRollback": {
55085520
"target": "com.amazonaws.cloudformation#DisableRollback",
55095521
"traits": {
5510-
"smithy.api#documentation": "<p>Preserves the state of previously provisioned resources when an operation fails.</p>\n <p>Default: <code>True</code>\n </p>"
5522+
"smithy.api#documentation": "<p>Preserves the state of previously provisioned resources when an operation\n fails. This parameter can't be specified when\n the <code>OnStackFailure</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html\">CreateChangeSet</a> API operation was\n specified.</p>\n <ul>\n <li>\n <p>\n <code>True</code> - if the stack creation fails, do nothing. This is equivalent to specifying\n <code>DO_NOTHING</code> for the <code>OnStackFailure</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html\">CreateChangeSet</a> API operation.</p>\n </li>\n <li>\n <p>\n <code>False</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying\n <code>ROLLBACK</code> for the <code>OnStackFailure</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html\">CreateChangeSet</a> API operation.</p>\n </li>\n </ul>\n <p>Default: <code>True</code>\n </p>"
55115523
}
55125524
}
55135525
},
@@ -7471,6 +7483,29 @@
74717483
}
74727484
}
74737485
},
7486+
"com.amazonaws.cloudformation#OnStackFailure": {
7487+
"type": "enum",
7488+
"members": {
7489+
"DO_NOTHING": {
7490+
"target": "smithy.api#Unit",
7491+
"traits": {
7492+
"smithy.api#enumValue": "DO_NOTHING"
7493+
}
7494+
},
7495+
"ROLLBACK": {
7496+
"target": "smithy.api#Unit",
7497+
"traits": {
7498+
"smithy.api#enumValue": "ROLLBACK"
7499+
}
7500+
},
7501+
"DELETE": {
7502+
"target": "smithy.api#Unit",
7503+
"traits": {
7504+
"smithy.api#enumValue": "DELETE"
7505+
}
7506+
}
7507+
}
7508+
},
74747509
"com.amazonaws.cloudformation#OperationIdAlreadyExistsException": {
74757510
"type": "structure",
74767511
"members": {

0 commit comments

Comments
 (0)