Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

fix(cloudformation): emit REVIEW_IN_PROGRESS event for change-set-created stacks (#890)

maximooseminef7a7efb42200
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29f6a8de..db6d5f0e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ Unreleased
## [Unreleased]
### Fixed
+- **CloudFormation — `DescribeStackEvents` returns the initial `REVIEW_IN_PROGRESS` event for change-set-created stacks** — creating a stack via `CreateChangeSet` with `--change-set-type CREATE` left the placeholder stack in `REVIEW_IN_PROGRESS` but seeded an empty event list, so `DescribeStackEvents` returned `[]`. AWS records an initial `REVIEW_IN_PROGRESS` event for the `AWS::CloudFormation::Stack` resource at this point; tools that read `StackEvents[0]`, notably `sam deploy`, crashed with `IndexError: list index out of range`. The placeholder stack now emits the `REVIEW_IN_PROGRESS` event on creation.
- **Step Functions — `ecs:runTask` / `ecs:runTask.sync` no longer drop `ContainerOverrides`** — the Pascal→camelCase conversion at the SFN→ECS hand-off only covered top-level Parameters keys, so `Overrides.ContainerOverrides` (including resolved `"Value.$"` entries) stayed PascalCase and was silently ignored: the container ran with task-definition env only while the task launched and the `.sync` state succeeded. The conversion is now recursive; nested `NetworkConfiguration` is covered by the same pass. (#886)
---
diff --git a/ministack/services/cloudformation/changesets.py b/ministack/services/cloudformation/changesets.py
index 39d5f474..886b9063 100644
--- a/ministack/services/cloudformation/changesets.py
+++ b/ministack/services/cloudformation/changesets.py
@@ -91,6 +91,9 @@ def _create_change_set(params):
}
_stacks[stack_name] = stack
_stack_events[stack_id] = []
+ _add_event(stack_id, stack_name, stack_name,
+ "AWS::CloudFormation::Stack", "REVIEW_IN_PROGRESS",
+ physical_id=stack_id)
else:
if not stack:
return _error("ValidationError",
diff --git a/tests/test_cfn.py b/tests/test_cfn.py
index 7d3b2cb9..4fcb21e6 100644
--- a/tests/test_cfn.py
+++ b/tests/test_cfn.py
@@ -375,6 +375,34 @@ def test_cfn_change_set_lifecycle(cfn):
stack = _wait_stack(cfn, "cfn-t08")
assert stack["StackStatus"] == "CREATE_COMPLETE"
+def test_cfn_change_set_create_emits_review_event(cfn):
+ template = {
+ "AWSTemplateFormatVersion": "2010-09-09",
+ "Resources": {
+ "Bucket": {
+ "Type": "AWS::S3::Bucket",
+ "Properties": {"BucketName": "cfn-t08b-cs"},
+ },
+ },
+ }
+ cfn.create_change_set(
+ StackName="cfn-t08b",
+ ChangeSetName="cfn-t08b-cs1",
+ TemplateBody=json.dumps(template),
+ ChangeSetType="CREATE",
+ )
+ time.sleep(1)
+
+ stack = cfn.describe_stacks(StackName="cfn-t08b")["Stacks"][0]
+ assert stack["StackStatus"] == "REVIEW_IN_PROGRESS"
+
+ events = cfn.describe_stack_events(StackName="cfn-t08b")["StackEvents"]
+ assert len(events) > 0
+ review = events[0]
+ assert review["ResourceStatus"] == "REVIEW_IN_PROGRESS"
+ assert review["ResourceType"] == "AWS::CloudFormation::Stack"
+ assert review["LogicalResourceId"] == "cfn-t08b"
+
def test_cfn_update_stack(cfn, s3):
template_v1 = {
"AWSTemplateFormatVersion": "2010-09-09",