'CDK's CodePipeline or CodeBuildStep are leaving an S3 bucket behind, is there a way of automatically removing it?
I'm creating a CloudFormation stack using CDK with code roughly like this:
export class PipelineStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: PipelineStackProps) {
super(scope, id, props)
new pipelines.CodePipeline(this, id, {
pipelineName: id,
synth: new pipelines.CodeBuildStep("Synth", {
input: pipelines.CodePipelineSource.connection(props.githubRepo, props.repoBranch, {connectionArn: props.repoConnectionArn}),
installCommands: ["npm install -g aws-cdk"],
commands: ["npm ci", "npx cdk synth"],
},
),
})
}
}
and that stack creates an S3 bucket that when I delete the stack isn't deleted with it. I searched for options and I couldn't find any to control that behaviour. Is it possible to mark that S3 bucket as cdk.RemovalPolicy.DESTROY or something like that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
