Skip to content
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

bug: Nested Stack not deleted when parent stack in ROLLBACK_COMPLETE status is deleted #10826

Open
1 task done
lukasz-mazur2 opened this issue May 15, 2024 · 0 comments
Open
1 task done
Labels
aws:cloudformation AWS CloudFormation status: backlog Triaged but not yet being worked on type: bug Bug report

Comments

@lukasz-mazur2
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Template contents:

$ cat modules-test-templates/test-module-cloudformation-alb-v1.0.0.yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  VPC:
    Type: AWS::EC2::VPC::Id
    Default: vpc-17c17d56
  SubnetDMZA:
    Type: AWS::EC2::Subnet::Id
    Default: subnet-879e3ee0
  SubnetDMZB:
    Type: AWS::EC2::Subnet::Id
    Default: subnet-c819287c
Resources:
  LoadBalancer:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: https://test-standard-common-modules.s3.localhost.localstack.cloud/templates/cloudformation-alb/1/0/cloudformation-alb-v1.0.0.yaml
      Parameters:
        ResourceNamePrefix: system-team-it
        VPC:
          Ref: VPC
        Subnets:
          Fn::Sub: ${SubnetDMZA}, ${SubnetDMZB}
        DomainName: localstack.test.cloud
Outputs:
  ALBARN:
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - Outputs.ARN
  ALBDNSName:
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - Outputs.DNSName
  ALBSecurityGroupID:
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - Outputs.SecurityGroupID
  ALBListener:
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - Outputs.Listener

Deployment:

$ awslocal cloudformation deploy --stack-name lm-test --template-file modules-test-templates/test-module-cloudformation-alb-v1.0.0.yaml

Waiting for changeset to be created..
Waiting for stack create/update to complete

Failed to create/update the stack. Run the following command
to fetch the list of events leading up to the failure
aws cloudformation describe-stack-events --stack-name lm-test

Deployed stakcs:

$ awslocal cloudformation list-stacks --query "StackSummaries[].StackId" | grep lm
    "arn:aws:cloudformation:eu-west-1:000000000000:stack/lm-test/c6f89e25",
    "arn:aws:cloudformation:eu-west-1:000000000000:stack/lm-test-LoadBalancer-ef50c545/86ddbbe4"

We delete the failed parent stack:

$ awslocal cloudformation delete-stack --stack-name lm-test

$ awslocal cloudformation describe-stacks --stack-name arn:aws:cloudformation:eu-west-1:000000000000:stack/lm-test/c6f89e25
{
    "Stacks": [
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:000000000000:stack/lm-test/c6f89e25",
            "StackName": "lm-test",
            "ChangeSetId": "arn:aws:cloudformation:eu-west-1:000000000000:changeSet/awscli-cloudformation-package-deploy-1715782194/d4753bb2",
            "Description": "Created by AWS CLI at 2024-05-15T14:09:54.148550 UTC",
            "Parameters": [
                {
                    "ParameterKey": "VPC",
                    "ParameterValue": "vpc-17c17d56"
                },
                {
                    "ParameterKey": "SubnetDMZA",
                    "ParameterValue": "subnet-879e3ee0"
                },
                {
                    "ParameterKey": "SubnetDMZB",
                    "ParameterValue": "subnet-c819287c"
                }
            ],
            "CreationTime": "2024-05-15T14:09:54.168000Z",
            "DeletionTime": "2024-05-15T14:11:03.129000Z",
            "LastUpdatedTime": "2024-05-15T14:09:54.168000Z",
            "RollbackConfiguration": {},
            "StackStatus": "DELETE_COMPLETE",
            "StackStatusReason": "Unexpected status: ROLLBACK_COMPLETE",
            "DisableRollback": false,
            "NotificationARNs": [],
            "Tags": [],
            "EnableTerminationProtection": false,
            "DriftInformation": {
                "StackDriftStatus": "NOT_CHECKED"
            }
        }
    ]
}

Nested stack still in ROLLBACK_COMPLETE state:

$ awslocal cloudformation describe-stacks --stack-name arn:aws:cloudformation:eu-west-1:000000000000:st
ack/lm-test-LoadBalancer-ef50c545/86ddbbe4
{
    "Stacks": [
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:000000000000:stack/lm-test-LoadBalancer-ef50c545/86ddbbe4",
            "StackName": "lm-test-LoadBalancer-ef50c545",
            "Description": "Template for Application LoadBalancer (no CloudFront) (v1.0.0-1bded9a-20240226T14Z)",
            "CreationTime": "2024-05-15T14:09:54.307000Z",
            "LastUpdatedTime": "2024-05-15T14:09:54.307000Z",
            "RollbackConfiguration": {},
            "StackStatus": "ROLLBACK_COMPLETE",
            "DisableRollback": false,
            "NotificationARNs": [],
            "Capabilities": [
                "CAPABILITY_IAM",
                "CAPABILITY_NAMED_IAM",
                "CAPABILITY_AUTO_EXPAND"
            ],
            "Tags": [],
            "EnableTerminationProtection": false,
            "DriftInformation": {
                "StackDriftStatus": "NOT_CHECKED"
            }
        }
    ]
}

Expected Behavior

Nested stack to be deleted along the parent stack.

How are you starting LocalStack?

With the localstack script

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run \
--rm \
--name localstack-main \
-p 4566:4566 \
-p 4510-4559:4510-4559 \
-e LOCALSTACK_AUTH_TOKEN="$LOCALSTACK_AUTH_TOKEN" \
-e LS_LOG=DEBUG  \
-e POD_LOAD_CLI_TIMEOUT=3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
localstack/localstack-pro:3.4.0

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

awslocal cloudformation delete-stack --stack-name lm-test

Environment

- OS: 5.15.146.1-microsoft-standard-WSL2
- LocalStack: 3.4.1.dev20240425063645:c7494f2

Anything else?

No response

@lukasz-mazur2 lukasz-mazur2 added status: triage needed Requires evaluation by maintainers type: bug Bug report labels May 15, 2024
@Anze1508 Anze1508 added aws:cloudformation AWS CloudFormation status: backlog Triaged but not yet being worked on and removed status: triage needed Requires evaluation by maintainers labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:cloudformation AWS CloudFormation status: backlog Triaged but not yet being worked on type: bug Bug report
Projects
None yet
Development

No branches or pull requests

2 participants