Skip to content

Commit a3c8a0a

Browse files
committed
chore: remove unnecessary defensive checks from drift detection
Remove DELETE_COMPLETE/DELETE_FAILED handling and Stack-without-ChangeSetId guard. Both defended against scenarios that can't happen in practice (nested changesets don't get deleted during analysis, and IncludeNestedStacks always creates changeset IDs).
1 parent a3de511 commit a3c8a0a

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

packages/amplify-cli/src/commands/drift-detection/detect-template-drift.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,6 @@ async function analyzeChangeSet(
308308
const changeInfo: ResourceChangeWithNested = { ...rc };
309309

310310
// Check if this is a nested stack with its own changeset
311-
if (rc.ResourceType === 'AWS::CloudFormation::Stack' && !rc.ChangeSetId) {
312-
// Stack change without a nested changeset — can't inspect its contents.
313-
// This happens when IncludeNestedStacks creates the root changeset but the
314-
// nested changeset failed before being created. Track as incomplete.
315-
const stackLabel = rc.LogicalResourceId || rc.PhysicalResourceId || 'unknown';
316-
print.warn(`Nested stack ${stackLabel} has no changeset — tracking as incomplete`);
317-
skippedStacks.push(stackLabel);
318-
result.changes.push(changeInfo);
319-
continue;
320-
}
321311
if (rc.ResourceType === 'AWS::CloudFormation::Stack' && rc.ChangeSetId && rc.PhysicalResourceId) {
322312
try {
323313
// Extract stack name and changeset name from ARNs using parseArn utility
@@ -336,7 +326,7 @@ async function analyzeChangeSet(
336326
ChangeSetName: changeSetName,
337327
}),
338328
);
339-
const terminalStatuses = ['CREATE_COMPLETE', 'FAILED', 'DELETE_COMPLETE', 'DELETE_FAILED'];
329+
const terminalStatuses = ['CREATE_COMPLETE', 'FAILED'];
340330
const NESTED_POLL_MAX_ATTEMPTS = 30;
341331
const NESTED_POLL_INTERVAL_MS = 2000;
342332
for (let attempt = 0; !terminalStatuses.includes(nestedChangeSet.Status ?? '') && attempt < NESTED_POLL_MAX_ATTEMPTS; attempt++) {
@@ -356,14 +346,6 @@ async function analyzeChangeSet(
356346
continue;
357347
}
358348

359-
// Deleted or failed-to-delete changesets can't be analyzed — track as incomplete
360-
if (nestedChangeSet.Status === 'DELETE_COMPLETE' || nestedChangeSet.Status === 'DELETE_FAILED') {
361-
print.warn(`Nested changeset ${stackName} was deleted (${nestedChangeSet.Status}) — tracking as incomplete`);
362-
skippedStacks.push(stackName);
363-
result.changes.push(changeInfo);
364-
continue;
365-
}
366-
367349
// Print nested changeset details
368350
if (nestedChangeSet.Changes && nestedChangeSet.Changes.length > 0) {
369351
print.debug(`Nested Stack: ${stackName}`);

0 commit comments

Comments
 (0)