Hello AWS Community,
in my team we have just on AWS Account, and that way we deploy th PreProdand ro stages in tghe same account.
the Problem is: i wanant to delete all stacks produced through the **PreProd **stage before moving to the **Pre **stage because of duplicat names ... etc.
i tried using the command
cdk destroy --app 'npx ts-node ./bin/AutBusBackend.ts' --all --force"
but the destroy here is deleting the stacks without the prefix Pre, and in this time we don't have anway this stacks.
Do you know how can i get ride of this problem to delete the stacks that are preduced in the current stage before and not the default stacks names in cdk.out ?
here is my pipeline code
const repo = codecommit.Repository.fromRepositoryName(this, 'AutbusBackendRepo', 'AutbusBackend');
const pipeline = new CodePipeline(this, 'AutBusPipeline', {
pipelineName: 'AutBusPipeline',
synth: new ShellStep('Synth', {
input: CodePipelineSource.codeCommit(repo, 'master'),
commands: [
'npm install -g npm',
'npm install',
'npm ci',
'npm run build',
'npm run cdk -- synth'
]
})
});
const preProd = pipeline.addStage(new AppStage(this, 'PreProd',{
env: {
account: account,
region: region
}
}));
const step1 = new ShellStep('IntegrationTesting', {
commands: [
'npm install',
'npm test'
]
});
const step2 = new ManualApprovalStep('Manual approval before Prod');
const step3 = new ShellStep('Delete deployed Stacks', {
commands: [
'npm install',
'npm install -g aws-cdk',
"cdk destroy --app 'npx ts-node ./bin/AutBusBackend.ts' --all --force"
]
});
// step2.addStepDependency(step1);
// step3.addStepDependency(step2);
// preProd.addPost(step3);
// preProd.addPost(step2);
// preProd.addPost(step1);
const prodStage = pipeline.addStage(new AppStage(this, 'Prod', {
env: {
account: account,
region: region
}
}));
Thanks in adavance for any new insiring idea