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

aws_docdbelastic : Changing AUTH_TYPE doesn't trigger replacement #29251

Open
Exter-dg opened this issue Feb 26, 2024 · 2 comments
Open

aws_docdbelastic : Changing AUTH_TYPE doesn't trigger replacement #29251

Exter-dg opened this issue Feb 26, 2024 · 2 comments
Assignees
Labels
@aws-cdk/aws-docdb Related to Amazon DocumentDB bug This issue is a bug. effort/medium Medium work item – several days of effort p3

Comments

@Exter-dg
Copy link

Exter-dg commented Feb 26, 2024

Describe the bug

Changing AUTH_TYPE doesn't trigger replacement

Expected Behavior

When I try to change the AUTH_TYPE of Elastic docdb cluster from PLAIN_TEXT to SECRET_ARN, a replacement should be triggered. Wherein, the old cluster should be deleted and new cluster should be created.

Current Behavior

When I try to change the AUTH_TYPE of Elastic docdb cluster from PLAIN_TEXT to SECRET_ARN or vice-versa, a new cluster is created but it fails with an error that cluster with this name already exists.

Error -

Cluster name xyz is not valid because cluster xyz exists. (Service: DocDbElastic, Status Code: 400, Request ID: 7bd649c5-77ff-4d38-85ca-2eb51fcb4c75)"

Even the CDK diff shows that the cluster will be replaced

~] AWS::DocDBElastic::Cluster elasticDocDbCluster elasticDocDbCluster replace
 ├─ [~] AdminUserPassword
 │   └─ @@ -1,1 +1,3 @@
 │      [-] "adminUserPassword"
 │      [+] {
 │      [+]   "Ref": "docDbSecret44E78"
 │      [+] }
 └─ [~] AuthType (requires replacement)
     ├─ [-] PLAIN_TEXT
     └─ [+] SECRET_ARN

Reproduction Steps

Change AUTH_TYPE of existing cluster from CDK.

Possible Solution

Cloud formation shows that it is creating a new resource. Shouldn't it delete the old one first?
image

Additional Information/Context

No response

CDK CLI Version

2.123.0

Framework Version

No response

Node.js Version

v16.20.2

OS

Linux/UNIX

Language

TypeScript

Language Version

No response

Other information

No response

@Exter-dg Exter-dg added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 26, 2024
@github-actions github-actions bot added the @aws-cdk/triggers Related to the triggers package label Feb 26, 2024
@GavinZZ GavinZZ self-assigned this Feb 26, 2024
@pahud
Copy link
Contributor

pahud commented Feb 26, 2024

Can you share your CDK code? I guess this could be a CFN bug as the ClusterName is required but replacing with a new one is having a conflict.

@pahud pahud added p2 effort/medium Medium work item – several days of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 26, 2024
@Exter-dg
Copy link
Author

@pahud Here is the snippet

import {
  aws_docdbelastic as docdbelastic,
  aws_secretsmanager as secretsmanager
} from 'aws-cdk-lib';

/**
 * Create a new secret
 * https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html
 */
const secret = new secretsmanager.Secret(this, 'Secret', {
  description: SecretDescription,
  secretName: SecretName,
  generateSecretString: {
    excludeCharacters: '/@":+&$?#[]',
  }
});

/**
 * Create a new Document DB Elastic Cluster
 * https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_docdbelastic.CfnCluster.html
 */
new docdbelastic.CfnCluster(this, 'elasticDocDbCluster', {
  adminUserName: AdminUserName,
  adminUserPassword: secret.secretArn,
  authType: "SECRET_ARN",
  clusterName: "ClusterName",
  shardCapacity: ShardCapacity,
  shardCount: ShardCount,
  subnetIds: dataSubnets,
  vpcSecurityGroupIds: [securityGroup.securityGroupId],
});

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 27, 2024
@GavinZZ GavinZZ removed their assignment Feb 27, 2024
@vinayak-kukreja vinayak-kukreja added @aws-cdk/aws-docdb Related to Amazon DocumentDB and removed @aws-cdk/triggers Related to the triggers package labels Apr 12, 2024
@pahud pahud self-assigned this Jun 3, 2024
@pahud pahud added p3 and removed p2 labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-docdb Related to Amazon DocumentDB bug This issue is a bug. effort/medium Medium work item – several days of effort p3
Projects
None yet
Development

No branches or pull requests

4 participants