-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Secret rotation for manage_master_user_password in RDS cluster #32405
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Hey @eugeneoei 👋 Thank you for taking the time to raise this! It looks like this would be an enhancement to the |
hi @justinretzolk , thank you for following up on this. look forward to the enhancement! 😄 |
👍 I'm also looking to use this enhancement! |
It's a must have option. e.g. to disable it or to change the schedule |
I had a crack at a PR for this at the weekend. Seems its not as simple as just making the ARN optional. In the update method there is a call to cancel the rotation if the lambda ARN is not present, this will always be the case for a managed secret. We could do a lookup on the tag on the secret resource to check if it is managed by another service. Thoughts? The code I am referring to. Note it calls cancel rotation if the ARN is not provided which would become an func resourceSecretRotationUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).SecretsManagerConn(ctx)
secretID := d.Get("secret_id").(string)
if d.HasChanges("rotation_lambda_arn", "rotation_rules") {
if v, ok := d.GetOk("rotation_lambda_arn"); ok && v.(string) != "" {
input := &secretsmanager.RotateSecretInput{
RotationLambdaARN: aws.String(v.(string)),
RotationRules: expandRotationRules(d.Get("rotation_rules").([]interface{})),
SecretId: aws.String(secretID),
}
// AccessDeniedException: Secrets Manager cannot invoke the specified Lambda function.
_, err := tfresource.RetryWhenAWSErrCodeEquals(ctx, 1*time.Minute, func() (interface{}, error) {
return conn.RotateSecretWithContext(ctx, input)
}, "AccessDeniedException")
if err != nil {
return sdkdiag.AppendErrorf(diags, "updating Secrets Manager Secret Rotation (%s): %s", d.Id(), err)
}
} else {
input := &secretsmanager.CancelRotateSecretInput{
SecretId: aws.String(d.Id()),
}
_, err := conn.CancelRotateSecretWithContext(ctx, input)
if err != nil {
return sdkdiag.AppendErrorf(diags, "cancelling Secrets Manager Secret Rotation (%s): %s", d.Id(), err)
}
}
} |
Any news on this? I can take a crack at a PR if needed. |
I am also waiting for a fix. Any update? |
any update |
Me too, waiting for feature implementation |
Any progress? |
Relates #34108 I believe this issue was addressed with #34180 (released in This related design decision contains a partial example which can be modified to bring the managed secret rotation under management with Terraform. resource "aws_db_instance" "example" {
# additional configuration omitted for brevity
manage_master_user_password = true
}
# Use the output of the `master_user_secret` object, which includes `secret_arn`,
# to manage the rotation rules.
resource "aws_secretsmanager_secret_rotation" "example" {
secret_id = aws_db_instance.example.master_user_secret[0].secret_arn
rotation_rules {
automatically_after_days = 30
}
}
# Optionally fetch the secret data if attributes need to be used as inputs
# elsewhere.
data "aws_secretsmanager_secret" "example" {
arn = aws_db_instance.example.master_user_secret[0].secret_arn
} If this interpretation of the original issue is correct and the change above resolves it, please let us know and we can close this. |
how to disable rotation? |
Hi @jar-b , I was waiting for this fix so thank you for the feedback as I missed to see #34180 I took your partial example specifying Therefore we tried schedule_expression instead to set the rotation and this seems to be working fine.
So with using schedule_expression the change #34180 resolves from my point of view the original issue. |
Thanks for the correction and confirmation, @Petra-K63! Closed by #34180. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
hello,
in the resource
aws_rds_cluster
, setting themanage_master_user_password
argument allows RDS to manage the master user password in Secrets Manager. the rotation schedule of this secret can be set in AWS console without the need for a rotation function which is managed by RDS.will it be possible to set the rotation schedule of this AWS managed secret through
terraform
?References
i have looked at the resource
aws_secretsmanager_secret_rotation
, however therotation_lambda_arn
argument is a required field.through CLI, it is possible to set the rotation using the following as stated here in the AWS docs:
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: