@@ -50279,8 +50279,9 @@ function getChangeSetInfo(cfn, changeSetName, stackName) {
5027950279 throw new Error('Unexpected end of pagination');
5028050280 });
5028150281}
50282- function cleanupChangeSet(cfn, stack, params, failOnEmptyChangeSet, noDeleteFailedChangeSet) {
50282+ function cleanupChangeSet(cfn, stack, params, failOnEmptyChangeSet, noDeleteFailedChangeSet, changeSetId ) {
5028350283 return __awaiter(this, void 0, void 0, function* () {
50284+ var _a, _b;
5028450285 const knownErrorMessages = [
5028550286 `No updates are to be performed`,
5028650287 `The submitted information didn't contain changes`
@@ -50302,14 +50303,37 @@ function cleanupChangeSet(cfn, stack, params, failOnEmptyChangeSet, noDeleteFail
5030250303 knownErrorMessages.some(err => { var _a; return (_a = changeSetStatus.StatusReason) === null || _a === void 0 ? void 0 : _a.includes(err); })) {
5030350304 return stack.StackId;
5030450305 }
50305- throw new Error(`Failed to create Change Set: ${changeSetStatus.StatusReason}`);
50306+ // Get detailed failure information for change set creation failures
50307+ let failureReason = `Failed to create Change Set: ${changeSetStatus.StatusReason}`;
50308+ const eventChangeSetId = changeSetId || changeSetStatus.ChangeSetId;
50309+ if (eventChangeSetId) {
50310+ try {
50311+ core.info(`Attempting to get change set failure details for: ${eventChangeSetId}`);
50312+ const events = yield cfn.send(new client_cloudformation_1.DescribeEventsCommand({
50313+ ChangeSetName: eventChangeSetId,
50314+ Filters: { FailedEvents: true }
50315+ }));
50316+ core.info(`Retrieved ${((_a = events.OperationEvents) === null || _a === void 0 ? void 0 : _a.length) || 0} failed events for change set`);
50317+ const failedEvents = (_b = events.OperationEvents) === null || _b === void 0 ? void 0 : _b.filter(event => event.ResourceStatusReason);
50318+ if (failedEvents && failedEvents.length > 0) {
50319+ const reasons = failedEvents
50320+ .map(event => `${event.LogicalResourceId}: ${event.ResourceStatusReason}`)
50321+ .join('; ');
50322+ failureReason += `. Failed resources: ${reasons}`;
50323+ }
50324+ }
50325+ catch (error) {
50326+ core.info(`Failed to get change set event details: ${error}`);
50327+ }
50328+ }
50329+ throw new Error(failureReason);
5030650330 }
5030750331 });
5030850332}
5030950333function updateStack(cfn, stack, params, failOnEmptyChangeSet, noExecuteChangeSet, noDeleteFailedChangeSet) {
5031050334 return __awaiter(this, void 0, void 0, function* () {
5031150335 core.debug('Creating CloudFormation Change Set');
50312- yield cfn.send(new client_cloudformation_1.CreateChangeSetCommand(params));
50336+ const createResponse = yield cfn.send(new client_cloudformation_1.CreateChangeSetCommand(params));
5031350337 try {
5031450338 core.debug('Waiting for CloudFormation Change Set creation');
5031550339 yield (0, client_cloudformation_1.waitUntilChangeSetCreateComplete)({ client: cfn, maxWaitTime: 1800, minDelay: 10 }, {
@@ -50321,7 +50345,7 @@ function updateStack(cfn, stack, params, failOnEmptyChangeSet, noExecuteChangeSe
5032150345 core.debug('Change set creation waiter failed, getting change set info anyway');
5032250346 // Still try to get change set info even if waiter failed
5032350347 const changeSetInfo = yield getChangeSetInfo(cfn, params.ChangeSetName, params.StackName);
50324- const result = yield cleanupChangeSet(cfn, stack, params, failOnEmptyChangeSet, noDeleteFailedChangeSet);
50348+ const result = yield cleanupChangeSet(cfn, stack, params, failOnEmptyChangeSet, noDeleteFailedChangeSet, createResponse.Id );
5032550349 return { stackId: result, changeSetInfo };
5032650350 }
5032750351 // Get change set information
0 commit comments