aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
446 stars 198 forks source link

(pipelines): Destroying the pipeline does not destroy cross region S3 buckets #530

Open youngjeong46 opened 1 year ago

youngjeong46 commented 1 year ago

Describe the bug

When you create a Blueprints pipeline with cross region stages (for various environments), the pipeline will create cross-region support stacks which includes an S3 bucket. When the pipeline is destroyed, the S3 buckets are not deleted (most likely due to non-empty Cfn problem).

The problem rises when there needs to be dynamic pipeline testing (in my case it is testing the workshop for changes - but I've seen other use cases), and the pipeline is created and destroyed many times. Once the pipeline stack is initialized, cross-region support stack will fail because the same S3 bucket exists already.

Expected Behavior

When you re-deploy a pipeline to the same region, with the same target secondary/tertiary region, the cross-region support stack should deploy successfully.

Current Behavior

There will be errors similar to the following:

2022-11-02 18:05:15 UTC-0500 | pipeline-stack-support-us-east-1 | ROLLBACK_IN_PROGRESS | The following resource(s) failed to create: [CrossRegionCodePipelineReplicationBucketFC3227F2, CDKMetadata]. Rollback requested by user.
-- | -- | -- | --
2022-11-02 18:05:14 UTC-0500 | CDKMetadata | CREATE_FAILED | Resource creation cancelled
2022-11-02 18:05:13 UTC-0500 | CrossRegionCodePipelineReplicationBucketFC3227F2 | CREATE_FAILED | pipeline-stack-support-useplicationbucketb396d98d555a55691bab already exists

Reproduction Steps

cdk init --language typescript npm i typescript/~4.8.4 npm i @aws-quickstart/eks-blueprints

(after writing appropriate pipeline code)

cdk deploy pipeline-stack cdk destroy --all

(re-deploying pipeline stack)

cdk deploy pipeline-stack

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.50.0

EKS Blueprints Version

1.4.0

Node.js Version

v16.18.0

Environment details (OS name and version, etc.)

Cloud9 on AL2

Other information

No response

elamaran11 commented 11 months ago

@youngjeong46 Do you still observe this issue. Looks like the ticket is open for an year now.