fix(cloudformation): report CREATE events for a resource an update adds (#4932)

A logical id the stack did not hold before an UpdateStack is created, so AWS
reports CREATE_IN_PROGRESS and CREATE_COMPLETE (or CREATE_FAILED) for it and
DescribeStackResource shows CREATE_COMPLETE. Floci used the stack-wide update
flag and reported UPDATE_* instead. The resource loop now decides per resource
from whether the stack held it; stack-level statuses and the rollback of an
added resource are unchanged.
This commit is contained in:
Mario Toffia authored and GitHub committed 2026-10-11 15:12:12 -04:00
1 parent e28c58cc8a
commit 8c61aa441d
4 files changed
+151 -4

No files matched your search

@@ -1526,7 +1526,10 @@ public class CloudFormationService implements ResourceProvider {
stack.getResources().put(logicalId, resource);
}
String inProgressStatus = isCreate
// A logical id the stack did not hold is created, even on an update, as AWS
// reports it; that includes a resource whose condition just turned true.
boolean creating = isCreate || previousResource == null;
String inProgressStatus = creating
? "CREATE_IN_PROGRESS"
: "UPDATE_IN_PROGRESS";
addEvent(
@@ -1550,7 +1553,7 @@ public class CloudFormationService implements ResourceProvider {
}
resource.setUpdateReplacePolicy(
resDef.path("UpdateReplacePolicy").asText(null));
if (!isCreate) {
if (!creating) {
if ("CREATE_COMPLETE".equals(resource.getStatus())) {
resource.setStatus("UPDATE_COMPLETE");
} else if ("CREATE_FAILED".equals(resource.getStatus())) {