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

rds: secret rotation application should allow custom SemanticVersion #29531

Closed
2 tasks
pahud opened this issue Mar 18, 2024 · 3 comments
Closed
2 tasks

rds: secret rotation application should allow custom SemanticVersion #29531

pahud opened this issue Mar 18, 2024 · 3 comments
Labels
effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@pahud
Copy link
Contributor

pahud commented Mar 18, 2024

Describe the feature

The SemanticVersion is hardcoded in SecretApplocationRotation and here:

There's no way to allow users to customize the SemanticVersion for that.

Use Case

Some versions might be deprecated because of Lambda runtime deprecation and we can't just update the CDK code for that.

Proposed Solution

We should allow user to specify their desired custom SemanticVersion.

Other Information

Before we have a PR for this, a workaround is like:

  1. look up the latest semanticVersion for the serverless application. For example, this returns the SemanticVersion for us-east-1.
aws serverlessrepo get-application --application-id arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSMySQLRotationSingleUser --query ‘Version.SemanticVersion’
“1.1.431”
  1. Override the SemanticVersion with your custom version like:
export class DummyStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps) {
    super(scope, id, props);  

    const vpc = ec2.Vpc.fromLookup(this, 'Vpc', {isDefault: true });
    const instance = new rds.DatabaseInstance(this, 'Instance', {
      vpc,
      engine: rds.DatabaseInstanceEngine.MYSQL,
    });
    const rotation = instance.addRotationSingleUser();
    const secretRotation = instance.node.tryFindChild('RotationSingleUser') as secrets.SecretRotation;
    (secretRotation.node.defaultChild as sam.CfnApplication).addPropertyOverride('Location.SemanticVersion', '9999');
  }
}

In this sample, I am overriding the SemanticVersion to 9999.

  1. cdk synth and check the template you should see this
 "InstanceRotationSingleUser90E8AB49": {
   "Type": "AWS::Serverless::Application",
   "Properties": {
    "Location": {
     "ApplicationId": {
      "Fn::FindInMap": [
       "InstanceRotationSingleUserSARMappingFEA0C86E",
       {
        "Ref": "AWS::Partition"
       },
       "applicationId"
      ]
     },
     "SemanticVersion": "9999"
    },

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.132.0

Environment details (OS name and version, etc.)

all

@pahud pahud added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 18, 2024
@pahud
Copy link
Contributor Author

pahud commented Mar 18, 2024

related #18249

@pahud
Copy link
Contributor Author

pahud commented Mar 18, 2024

another workaround mentioned #18249 (comment)

Copy link

github-actions bot commented Jun 3, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

1 participant