aws-architect 6.7.67 → 6.7.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -115,14 +115,29 @@ class CloudFormationDeployer {
|
|
|
115
115
|
}
|
|
116
116
|
maxErrors += 1;
|
|
117
117
|
});
|
|
118
|
-
}).then(stackStatus => {
|
|
118
|
+
}).then(async stackStatus => {
|
|
119
119
|
console.log(`Current status of stack ${stackName} is ${stackStatus}.`);
|
|
120
120
|
if (stackStatus === 'REVIEW_IN_PROGRESS') {
|
|
121
121
|
throw { error: 'Current status of the stack has failed', status: stackStatus };
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if (!allowUpdateRollback && stackStatus === 'UPDATE_ROLLBACK_COMPLETE') {
|
|
125
|
-
|
|
125
|
+
const eventsResponse = await this.cloudFormationClient.describeStackEvents({ StackName: stackName }).promise();
|
|
126
|
+
const failureStackEventStatuses = {
|
|
127
|
+
CREATE_FAILED: true,
|
|
128
|
+
UPDATE_FAILED: true,
|
|
129
|
+
DELETE_FAILED: true,
|
|
130
|
+
IMPORT_FAILED: true,
|
|
131
|
+
IMPORT_ROLLBACK_FAILED: true,
|
|
132
|
+
UPDATE_ROLLBACK_FAILED: true,
|
|
133
|
+
ROLLBACK_FAILED: true
|
|
134
|
+
};
|
|
135
|
+
const mappedResults = eventsResponse.StackEvents.filter(event => failureStackEventStatuses[event.ResourceStatus]).map(result => ({
|
|
136
|
+
cloudFormationResourceName: result.LogicalResourceId, awsResourceId: result.PhysicalResourceId, error: result.ResourceStatusReason
|
|
137
|
+
}));
|
|
138
|
+
console.error('Stack status indicates failure because of the following events: ', mappedResults);
|
|
139
|
+
|
|
140
|
+
throw { title: 'Deployment to the stack failed.', status: stackStatus, code: stackStatus };
|
|
126
141
|
}
|
|
127
142
|
|
|
128
143
|
if (stackStatus.match(/PROGRESS$/i)) {
|
|
@@ -267,6 +282,9 @@ class CloudFormationDeployer {
|
|
|
267
282
|
|
|
268
283
|
return stackData.Stacks[0];
|
|
269
284
|
} catch (error) {
|
|
285
|
+
if (error.code === 'UPDATE_ROLLBACK_COMPLETE') {
|
|
286
|
+
throw error;
|
|
287
|
+
}
|
|
270
288
|
if (error.code === 'ValidationError' || error.code === 'MultipleValidationErrors' || error.code === 'InvalidParameterType') {
|
|
271
289
|
throw error;
|
|
272
290
|
}
|