Skip to content

Commit

Permalink
feat(client-cloudformation): Added DeletionMode FORCE_DELETE_STACK fo…
Browse files Browse the repository at this point in the history
…r deleting a stack that is stuck in DELETE_FAILED state due to resource deletion failure.
  • Loading branch information
awstools committed May 22, 2024
1 parent 1489723 commit 6f0caf6
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface DeleteStackCommandOutput extends __MetadataBearer {}
* ],
* RoleARN: "STRING_VALUE",
* ClientRequestToken: "STRING_VALUE",
* DeletionMode: "STANDARD" || "FORCE_DELETE_STACK",
* };
* const command = new DeleteStackCommand(input);
* const response = await client.send(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export interface DescribeStacksCommandOutput extends DescribeStacksOutput, __Met
* // LastCheckTimestamp: new Date("TIMESTAMP"),
* // },
* // RetainExceptOnCreate: true || false,
* // DeletionMode: "STANDARD" || "FORCE_DELETE_STACK",
* // DetailedStatus: "CONFIGURATION_COMPLETE" || "VALIDATION_FAILED",
* // },
* // ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { CloudFormationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudFormationClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { SetTypeConfigurationInput } from "../models/models_0";
import { SetTypeConfigurationOutput } from "../models/models_1";
import { SetTypeConfigurationInput, SetTypeConfigurationOutput } from "../models/models_1";
import { de_SetTypeConfigurationCommand, se_SetTypeConfigurationCommand } from "../protocols/Aws_query";

/**
Expand Down
107 changes: 53 additions & 54 deletions clients/client-cloudformation/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2777,7 +2777,7 @@ export interface StackSetOperationPreferences {
* <code>STRICT_FAILURE_TOLERANCE</code>: This option dynamically lowers the concurrency level to ensure the
* number of failed accounts never exceeds the value of <code>FailureToleranceCount</code> +1. The initial actual
* concurrency is set to the lower of either the value of the <code>MaxConcurrentCount</code>, or the value of
* <code>MaxConcurrentCount</code> +1. The actual concurrency is then reduced proportionally by the number of
* <code>FailureToleranceCount</code> +1. The actual concurrency is then reduced proportionally by the number of
* failures. This is the default behavior.</p>
* <p>If failure tolerance or Maximum concurrent accounts are set to percentages, the behavior is similar.</p>
* </li>
Expand Down Expand Up @@ -3446,6 +3446,20 @@ export class GeneratedTemplateNotFoundException extends __BaseException {
}
}

/**
* @public
* @enum
*/
export const DeletionMode = {
FORCE_DELETE_STACK: "FORCE_DELETE_STACK",
STANDARD: "STANDARD",
} as const;

/**
* @public
*/
export type DeletionMode = (typeof DeletionMode)[keyof typeof DeletionMode];

/**
* <p>The input for <a>DeleteStack</a> action.</p>
* @public
Expand Down Expand Up @@ -3492,6 +3506,24 @@ export interface DeleteStackInput {
* @public
*/
ClientRequestToken?: string;

/**
* <p>Specifies the deletion mode for the stack. Possible values are:</p>
* <ul>
* <li>
* <p>
* <code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this
* parameter.</p>
* </li>
* <li>
* <p>
* <code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to
* resource deletion failure.</p>
* </li>
* </ul>
* @public
*/
DeletionMode?: DeletionMode;
}

/**
Expand Down Expand Up @@ -6188,6 +6220,24 @@ export interface Stack {
*/
RetainExceptOnCreate?: boolean;

/**
* <p>Specifies the deletion mode for the stack. Possible values are:</p>
* <ul>
* <li>
* <p>
* <code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this
* parameter.</p>
* </li>
* <li>
* <p>
* <code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to
* resource deletion failure.</p>
* </li>
* </ul>
* @public
*/
DeletionMode?: DeletionMode;

/**
* <p>The detailed status of the resource or stack. If <code>CONFIGURATION_COMPLETE</code> is present, the resource or
* resource configuration phase has completed and the stabilization of the resources is in progress. The stack sets
Expand Down Expand Up @@ -8809,8 +8859,8 @@ export interface StackInstanceResourceDriftsSummary {
*/
export interface ListStackInstanceResourceDriftsOutput {
/**
* <p>A list of <code>StackInstanceResourceDriftSummary</code> structures that contain information about the specified
* stack instances.</p>
* <p>A list of <code>StackInstanceResourceDriftsSummary</code> structures that contain information about the
* specified stack instances.</p>
* @public
*/
Summaries?: StackInstanceResourceDriftsSummary[];
Expand Down Expand Up @@ -10941,54 +10991,3 @@ export interface SetStackPolicyInput {
*/
StackPolicyURL?: string;
}

/**
* @public
*/
export interface SetTypeConfigurationInput {
/**
* <p>The Amazon Resource Name (ARN) for the extension, in this account and Region.</p>
* <p>For public extensions, this will be the ARN assigned when you call the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ActivateType.html">ActivateType</a> API operation in this account
* and Region. For private extensions, this will be the ARN assigned when you call the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_RegisterType.html">RegisterType</a> API operation in this account
* and Region.</p>
* <p>Do not include the extension versions suffix at the end of the ARN. You can set the configuration for an
* extension, but not for a specific extension version.</p>
* @public
*/
TypeArn?: string;

/**
* <p>The configuration data for the extension, in this account and Region.</p>
* <p>The configuration data must be formatted as JSON, and validate against the schema returned in the
* <code>ConfigurationSchema</code> response element of <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeType.html">DescribeType</a>. For more information, see
* <a href="https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-model.html#resource-type-howto-configuration">Defining
* account-level configuration data for an extension</a> in the <i>CloudFormation CLI User
* Guide</i>.</p>
* @public
*/
Configuration: string | undefined;

/**
* <p>An alias by which to refer to this extension configuration data.</p>
* <p>Conditional: Specifying a configuration alias is required when setting a configuration for a resource type
* extension.</p>
* @public
*/
ConfigurationAlias?: string;

/**
* <p>The name of the extension.</p>
* <p>Conditional: You must specify <code>ConfigurationArn</code>, or <code>Type</code> and
* <code>TypeName</code>.</p>
* @public
*/
TypeName?: string;

/**
* <p>The type of extension.</p>
* <p>Conditional: You must specify <code>ConfigurationArn</code>, or <code>Type</code> and
* <code>TypeName</code>.</p>
* @public
*/
Type?: ThirdPartyType;
}
51 changes: 51 additions & 0 deletions clients/client-cloudformation/src/models/models_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,57 @@ import {
ThirdPartyType,
} from "./models_0";

/**
* @public
*/
export interface SetTypeConfigurationInput {
/**
* <p>The Amazon Resource Name (ARN) for the extension, in this account and Region.</p>
* <p>For public extensions, this will be the ARN assigned when you call the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ActivateType.html">ActivateType</a> API operation in this account
* and Region. For private extensions, this will be the ARN assigned when you call the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_RegisterType.html">RegisterType</a> API operation in this account
* and Region.</p>
* <p>Do not include the extension versions suffix at the end of the ARN. You can set the configuration for an
* extension, but not for a specific extension version.</p>
* @public
*/
TypeArn?: string;

/**
* <p>The configuration data for the extension, in this account and Region.</p>
* <p>The configuration data must be formatted as JSON, and validate against the schema returned in the
* <code>ConfigurationSchema</code> response element of <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeType.html">DescribeType</a>. For more information, see
* <a href="https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-model.html#resource-type-howto-configuration">Defining
* account-level configuration data for an extension</a> in the <i>CloudFormation CLI User
* Guide</i>.</p>
* @public
*/
Configuration: string | undefined;

/**
* <p>An alias by which to refer to this extension configuration data.</p>
* <p>Conditional: Specifying a configuration alias is required when setting a configuration for a resource type
* extension.</p>
* @public
*/
ConfigurationAlias?: string;

/**
* <p>The name of the extension.</p>
* <p>Conditional: You must specify <code>ConfigurationArn</code>, or <code>Type</code> and
* <code>TypeName</code>.</p>
* @public
*/
TypeName?: string;

/**
* <p>The type of extension.</p>
* <p>Conditional: You must specify <code>ConfigurationArn</code>, or <code>Type</code> and
* <code>TypeName</code>.</p>
* @public
*/
Type?: ThirdPartyType;
}

/**
* @public
*/
Expand Down
9 changes: 8 additions & 1 deletion clients/client-cloudformation/src/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ import {
ScannedResource,
ScannedResourceIdentifier,
SetStackPolicyInput,
SetTypeConfigurationInput,
Stack,
StackDriftInformation,
StackDriftInformationSummary,
Expand Down Expand Up @@ -472,6 +471,7 @@ import {
} from "../models/models_0";
import {
ResourceScanLimitExceededException,
SetTypeConfigurationInput,
SetTypeConfigurationOutput,
SetTypeDefaultVersionInput,
SetTypeDefaultVersionOutput,
Expand Down Expand Up @@ -4676,6 +4676,9 @@ const se_DeleteStackInput = (input: DeleteStackInput, context: __SerdeContext):
if (input[_CRT] != null) {
entries[_CRT] = input[_CRT];
}
if (input[_DM] != null) {
entries[_DM] = input[_DM];
}
return entries;
};

Expand Down Expand Up @@ -9501,6 +9504,9 @@ const de_Stack = (output: any, context: __SerdeContext): Stack => {
if (output[_REOC] != null) {
contents[_REOC] = __parseBoolean(output[_REOC]);
}
if (output[_DM] != null) {
contents[_DM] = __expectString(output[_DM]);
}
if (output[_DSeta] != null) {
contents[_DSeta] = __expectString(output[_DSeta]);
}
Expand Down Expand Up @@ -11135,6 +11141,7 @@ const _DDS = "DriftDetectionStatus";
const _DGT = "DeleteGeneratedTemplate";
const _DGTe = "DescribeGeneratedTemplate";
const _DI = "DriftInformation";
const _DM = "DeletionMode";
const _DOA = "DeactivateOrganizationsAccess";
const _DOAe = "DescribeOrganizationsAccess";
const _DP = "DescribePublisher";
Expand Down
33 changes: 31 additions & 2 deletions codegen/sdk-codegen/aws-models/cloudformation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,12 @@
"traits": {
"smithy.api#documentation": "<p>A unique identifier for this <code>DeleteStack</code> request. Specify this token if you plan to retry requests\n so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry\n <code>DeleteStack</code> requests to ensure that CloudFormation successfully received them.</p>\n <p>All events initiated by a given stack operation are assigned the same client request token, which you can use to\n track operations. For example, if you execute a <code>CreateStack</code> operation with the token\n <code>token1</code>, then all the <code>StackEvents</code> generated by that operation will have\n <code>ClientRequestToken</code> set as <code>token1</code>.</p>\n <p>In the console, stack operations display the client request token on the Events tab. Stack operations that are\n initiated from the console use the token format <i>Console-StackOperation-ID</i>, which helps you\n easily identify the stack operation . For example, if you create a stack using the console, each stack event would be\n assigned the same token in the following format:\n <code>Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002</code>.</p>"
}
},
"DeletionMode": {
"target": "com.amazonaws.cloudformation#DeletionMode",
"traits": {
"smithy.api#documentation": "<p>Specifies the deletion mode for the stack. Possible values are:</p>\n <ul>\n <li>\n <p>\n <code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this\n parameter.</p>\n </li>\n <li>\n <p>\n <code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to\n resource deletion failure.</p>\n </li>\n </ul>"
}
}
},
"traits": {
Expand Down Expand Up @@ -3579,6 +3585,23 @@
"smithy.api#output": {}
}
},
"com.amazonaws.cloudformation#DeletionMode": {
"type": "enum",
"members": {
"STANDARD": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#enumValue": "STANDARD"
}
},
"FORCE_DELETE_STACK": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#enumValue": "FORCE_DELETE_STACK"
}
}
}
},
"com.amazonaws.cloudformation#DeletionTime": {
"type": "timestamp"
},
Expand Down Expand Up @@ -7930,7 +7953,7 @@
"Summaries": {
"target": "com.amazonaws.cloudformation#StackInstanceResourceDriftsSummaries",
"traits": {
"smithy.api#documentation": "<p>A list of <code>StackInstanceResourceDriftSummary</code> structures that contain information about the specified\n stack instances.</p>"
"smithy.api#documentation": "<p>A list of <code>StackInstanceResourceDriftsSummary</code> structures that contain information about the\n specified stack instances.</p>"
}
},
"NextToken": {
Expand Down Expand Up @@ -11501,6 +11524,12 @@
"smithy.api#documentation": "<p>When set to <code>true</code>, newly created resources are deleted when the operation rolls back. This includes\n newly created resources marked with a deletion policy of <code>Retain</code>.</p>\n <p>Default: <code>false</code>\n </p>"
}
},
"DeletionMode": {
"target": "com.amazonaws.cloudformation#DeletionMode",
"traits": {
"smithy.api#documentation": "<p>Specifies the deletion mode for the stack. Possible values are:</p>\n <ul>\n <li>\n <p>\n <code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this\n parameter.</p>\n </li>\n <li>\n <p>\n <code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to\n resource deletion failure.</p>\n </li>\n </ul>"
}
},
"DetailedStatus": {
"target": "com.amazonaws.cloudformation#DetailedStatus",
"traits": {
Expand Down Expand Up @@ -13115,7 +13144,7 @@
"ConcurrencyMode": {
"target": "com.amazonaws.cloudformation#ConcurrencyMode",
"traits": {
"smithy.api#documentation": "<p>Specifies how the concurrency level behaves during the operation execution.</p>\n <ul>\n <li>\n <p>\n <code>STRICT_FAILURE_TOLERANCE</code>: This option dynamically lowers the concurrency level to ensure the\n number of failed accounts never exceeds the value of <code>FailureToleranceCount</code> +1. The initial actual\n concurrency is set to the lower of either the value of the <code>MaxConcurrentCount</code>, or the value of\n <code>MaxConcurrentCount</code> +1. The actual concurrency is then reduced proportionally by the number of\n failures. This is the default behavior.</p>\n <p>If failure tolerance or Maximum concurrent accounts are set to percentages, the behavior is similar.</p>\n </li>\n <li>\n <p>\n <code>SOFT_FAILURE_TOLERANCE</code>: This option decouples <code>FailureToleranceCount</code> from the actual\n concurrency. This allows stack set operations to run at the concurrency level set by the\n <code>MaxConcurrentCount</code> value, or <code>MaxConcurrentPercentage</code>, regardless of the number of\n failures.</p>\n </li>\n </ul>"
"smithy.api#documentation": "<p>Specifies how the concurrency level behaves during the operation execution.</p>\n <ul>\n <li>\n <p>\n <code>STRICT_FAILURE_TOLERANCE</code>: This option dynamically lowers the concurrency level to ensure the\n number of failed accounts never exceeds the value of <code>FailureToleranceCount</code> +1. The initial actual\n concurrency is set to the lower of either the value of the <code>MaxConcurrentCount</code>, or the value of\n <code>FailureToleranceCount</code> +1. The actual concurrency is then reduced proportionally by the number of\n failures. This is the default behavior.</p>\n <p>If failure tolerance or Maximum concurrent accounts are set to percentages, the behavior is similar.</p>\n </li>\n <li>\n <p>\n <code>SOFT_FAILURE_TOLERANCE</code>: This option decouples <code>FailureToleranceCount</code> from the actual\n concurrency. This allows stack set operations to run at the concurrency level set by the\n <code>MaxConcurrentCount</code> value, or <code>MaxConcurrentPercentage</code>, regardless of the number of\n failures.</p>\n </li>\n </ul>"
}
}
},
Expand Down

0 comments on commit 6f0caf6

Please sign in to comment.