Skip to content

fix: add --import-existing-resources to CDK deploy in integration-suite#1174

Merged
jchrostek-dd merged 1 commit intomainfrom
john/svls-8825
Apr 8, 2026
Merged

fix: add --import-existing-resources to CDK deploy in integration-suite#1174
jchrostek-dd merged 1 commit intomainfrom
john/svls-8825

Conversation

@jchrostek-dd
Copy link
Copy Markdown
Contributor

@jchrostek-dd jchrostek-dd commented Apr 8, 2026

What changed and why

Added --import-existing-resources flag to the npx cdk deploy command in the integration-suite CI job (.gitlab/templates/pipeline.yaml.tpl).

Root cause: When a pipeline fails mid-deploy, some AWS resources (specifically the dotnet Lambda log group /aws/lambda/integ-{IDENTIFIER}-{TEST_SUITE}-dotnet-lambda) are created in AWS but the CloudFormation stack is left in ROLLBACK_COMPLETE state. On a pipeline retry for the same commit (same IDENTIFIER = CI_COMMIT_SHORT_SHA), CDK attempts to create the already-existing log group and fails with:

ToolkitError: ChangeSet 'cdk-deploy-change-set' on stack 'integ-{IDENTIFIER}-{TEST_SUITE}' failed early validation:
  - Resource of type 'AWS::Logs::LogGroup' with identifier '/aws/lambda/integ-{IDENTIFIER}-{TEST_SUITE}-dotnet-lambda' already exists.

The --import-existing-resources flag tells CDK to import any already-existing resources into the stack instead of failing validation, which is the standard CDK solution for this exact scenario.

Jira

SVLS-8825

@jchrostek-dd jchrostek-dd marked this pull request as ready for review April 8, 2026 13:34
@jchrostek-dd jchrostek-dd requested a review from a team as a code owner April 8, 2026 13:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the --import-existing-resources flag to the CDK deploy command in the integration-suite CI job to handle pipeline retry scenarios. When a pipeline fails mid-deploy, AWS resources (particularly Lambda log groups) can be created in AWS, but the CloudFormation stack remains in ROLLBACK_COMPLETE state. On retry, CDK would fail trying to create already-existing resources. The flag tells CDK to import existing resources instead of failing validation, which is the standard CDK solution for this scenario.

Changes:

  • Added --import-existing-resources flag to the npx cdk deploy command in the integration-suite job

@jchrostek-dd jchrostek-dd merged commit 27d495f into main Apr 8, 2026
57 checks passed
@jchrostek-dd jchrostek-dd deleted the john/svls-8825 branch April 8, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants