-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix deletion of failed nested stack in CFn #11489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
77226ec
to
0872119
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice consistency change, thanks for resolving! A couple of minor suggestions, but LGTM!
@@ -81,7 +82,7 @@ def test_nested_stack_output_refs(deploy_cfn_template, s3_create_bucket, aws_cli | |||
assert f"{nested_bucket_name}-suffix" == result.outputs["CustomOutput"] | |||
|
|||
|
|||
@pytest.mark.skip(reason="Nested stacks don't work properly") | |||
@pytest.mark.skip(reason="Nested rtacks don't work properly") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pytest.mark.skip(reason="Nested rtacks don't work properly") | |
@pytest.mark.skip(reason="Nested stacks don't work properly") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An error from my part but thanks to it I found that we can delete the skip
def _stack_and_child_deleted(): | ||
stacks = aws_client.cloudformation.describe_stacks()["Stacks"] | ||
stacks_with_name = [s for s in stacks if stack_name in s["StackName"]] | ||
assert len(stacks_with_name) == 0 | ||
|
||
retry(_stack_and_child_deleted, sleep=2 if is_aws_cloud() else 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use a waiter here? Also it might be clearer to describe_stack(StackName=stack_name)
and catch the exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a while but test is a lot better now. I'll merge once is green.
a54f267
to
229c705
Compare
Motivation
Addresses #10826. The resource_provider class only stores the new model properties if the create operation is successful. This can cause issues where a nested stack reaches a failed status after being in a pending state. The Id property is never stored, and if the delete method is called, the property required for deletion cannot be found.
Changes
Testing