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

(cdk-migrate): UpdateReplacePolicy is not defined #29635

Open
sato-tis opened this issue Mar 28, 2024 · 2 comments
Open

(cdk-migrate): UpdateReplacePolicy is not defined #29635

sato-tis opened this issue Mar 28, 2024 · 2 comments
Assignees
Labels
bug This issue is a bug. cli Issues related to the CDK CLI effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI toolkit/migrate Related to cdk migrate

Comments

@sato-tis
Copy link

Describe the bug

I'm using CDK migrate to create a CDK app for my already deployed CloudFormation Stack.

The CFN template contains an AWS::Logs::LogGroup with the following property:

KinesisLog:
    Type: AWS::Logs::LogGroup
    DeletionPolicy: Retain
    UpdateReplacePolicy: Retain
    Properties:
      LogGroupName: dev-kinesis-logs
      RetentionInDays: 90

This gets migrated into the following L1 construct code:

/**
 * TEST
 */
export class TestStack extends cdk.Stack {
  public constructor(scope: cdk.App, id: string, props: TestStackProps = {}) {
    super(scope, id, props);

    // Resources
    const kinesisLog = new logs.CfnLogGroup(this, 'KinesisLog', {
      logGroupName: `dev-kinesis-logs`,
      retentionInDays: 90,
    });
    kinesisLog.cfnOptions.deletionPolicy = cdk.CfnDeletionPolicy.RETAIN;
  }
}

which after synth gives us:

Resources:
  KinesisLog:
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName: dev-kinesis-logs
      RetentionInDays: 90
    DeletionPolicy: Retain
    Metadata:
      aws:cdk:path: test/KinesisLog

UpdateReplacePolicy did not exist.

Expected Behavior

It was assumed that the UpdateReplacePolicy setting would be included after cdk migrate.

Current Behavior

After migrating the CloudFormation stack with cdk migrate, UpdateReplacePolicy did not exist.

Reproduction Steps

see above CFN snippet

Possible Solution

No response

Additional Information/Context

When you run the cdk diff command, the UpdateReplacePolicy is removed.

cdk diff command results:

Stack test
Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)
Template
[-] AWSTemplateFormatVersion AWSTemplateFormatVersion: 2010-09-09
[-] Description Description: TEST

Parameters
[+] Parameter BootstrapVersion BootstrapVersion: {"Type":"AWS::SSM::Parameter::Value<String>","Default":"/cdk-bootstrap/hnb659fds/version","Description":"Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"}

Resources
[~] AWS::Logs::LogGroup KinesisLog KinesisLog 
 └─ [-] UpdateReplacePolicy
     └─ Retain

Other Changes
[+] Unknown Rules: {"CheckBootstrapVersion":{"Assertions":[{"Assert":{"Fn::Not":[{"Fn::Contains":[["1","2","3","4","5"],{"Ref":"BootstrapVersion"}]}]},"AssertDescription":"CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."}]}}


✨  Number of stacks with differences: 1

CDK CLI Version

2.133.0

Framework Version

No response

Node.js Version

v20.12.0

OS

Linux

Language

TypeScript

Language Version

~5.3.3

Other information

No response

@sato-tis sato-tis added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 28, 2024
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Mar 28, 2024
@tim-finnigan tim-finnigan self-assigned this Mar 29, 2024
@tim-finnigan tim-finnigan added investigating This issue is being investigated and/or work is in progress to resolve the issue. toolkit/migrate Related to cdk migrate p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Mar 29, 2024
@tim-finnigan
Copy link

Thanks for reporting this, I could reproduce the issue.

@khushail khushail added the cli Issues related to the CDK CLI label Apr 10, 2024
@TheRealAmazonKendra
Copy link
Contributor

Thanks for reporting this to us. We've now implemented that and this will be available in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. cli Issues related to the CDK CLI effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI toolkit/migrate Related to cdk migrate
Projects
None yet
Development

No branches or pull requests

4 participants