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

cloudformation stack termination protection is ignored when deployed through pipelines (L3) module #30405

Closed
andreprawira opened this issue May 31, 2024 · 4 comments
Labels
@aws-cdk/aws-cloudformation Related to AWS CloudFormation bug This issue is a bug. effort/small Small work item – less than a day of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p1

Comments

@andreprawira
Copy link

andreprawira commented May 31, 2024

Describe the bug

i'm deploying just a simple s3 stack that creates an s3 bucket, here is the code

class S3(Stack):
    def __init__(
        self, scope: Construct, construct_id: str, props: S3StackProps, **kwargs
    ) -> None:
        super().__init__(scope, construct_id, termination_protection=True, **kwargs)
        
frontend_bucket = s3.Bucket(
            self,
            "frontend-bucket",
            removal_policy=cdk.RemovalPolicy.DESTROY,
            auto_delete_objects=True,
            object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
            bucket_name="my-frontend-bucket",
        )

If i deploy this stack locally (cdk deploy s3 stack), the stack and the bucket got created succesfully AND the stack itself has termination protection activated. However, if I deploy this stack using this pipelines L3 module (i have to define the stage and instantiate the S3Stack)

class ApplicationStage(Stage):
    def __init__(
        self, scope: Construct, id: str, props: ApplicationStageProps, **kwargs
    ):
        super().__init__(scope, id, **kwargs)

        S3Stack(
            self,
            "s3-stack",
            props=CloudfrontStackProps(
                customer=props.customer,
            ),
        )

then if i destroy the previously existing S3 stack first, then if i release the pipeline, it works, the stage is created, and the stack got created. However, the stack itself doesnt have termination protection enabled.

Expected Behavior

termination protection on the stack created by codepipeline should also be activated

Current Behavior

termination protection on the stack created by codepipeline is deactivated

Reproduction Steps

please view my code

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.117.0 (build 59d9b23)

Framework Version

No response

Node.js Version

v18.18.0

OS

Windows

Language

Python

Language Version

Python 3.11.5

Other information

No response

@andreprawira andreprawira added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 31, 2024
@github-actions github-actions bot added the @aws-cdk/aws-cloudformation Related to AWS CloudFormation label May 31, 2024
@khushail khushail added needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels May 31, 2024
@andreprawira
Copy link
Author

@khushail can you help pls

@andreprawira andreprawira changed the title cloudformation stack termination protection is ignored when deployed in codepipeline cloudformation stack termination protection is ignored when deployed through pipelines (L3) module Jun 1, 2024
@khushail
Copy link
Contributor

khushail commented Jun 3, 2024

@andreprawira , Thanks for reaching out.
I see that a request have been added on the cloudformation coverage roadmap and also team decided in putting out a warning for the pipeline based deployment. CDK Team has already filed internal ticket (Ticket -D36476047) with Cloudformation team to provide support for this. I would check the ticket and see if we can get any traction on that.

Since this is a duplicate issue, I would be closing this one and will post further updates on previous issue. Thanks!

@khushail khushail added p1 effort/small Small work item – less than a day of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. and removed needs-reproduction This issue needs reproduction. labels Jun 3, 2024
@khushail khushail closed this as completed Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-cloudformation Related to AWS CloudFormation bug This issue is a bug. effort/small Small work item – less than a day of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p1
Projects
None yet
Development

No branches or pull requests

3 participants