with version 1.19.0 , below script works fine.
import secretsmanager = require('@aws-cdk/aws-secretsmanager');
const target : secretsmanager.ISecretAttachmentTarget = {
asSecretAttachmentTarget: () => ({
targetId: `arn:aws:rds:${this.region}:${this.account}:cluster:${this.database.ref}`,
targetType: secretsmanager.AttachmentTargetType.CLUSTER
})
};
const myUserSecretAttached = this.dbSecrets.addTargetAttachment('AttachedSecret', {target})
with version 1.20.0, addTargetAttachment is deprecated.So I have used attach. In ISecretAttachmentTarget targetType ' secretsmanager.AttachmentTargetType' is deprecated. so what is the alternative ? I have tried the below script which throws error 'Deprecated symbol used, consult docs for better alternative.'
import secretsmanager = require('@aws-cdk/aws-secretsmanager');
const target : secretsmanager.ISecretAttachmentTarget = {
asSecretAttachmentTarget: () => ({
targetId: `arn:aws:rds:${this.region}:${this.account}:cluster:${this.database.ref}`,
targetType: secretsmanager.AttachmentTargetType.CLUSTER
})
};
const myUserSecretAttached = this.dbSecrets.attach(target)