How to disable automatic secret rotation of AWS Secrets Manager using Terraform?

I have a secret stored in AWS Secrets Manager deployed using a Terraform module which enables secret rotation. I don't have access to the source code of that module so I can't modify it. I want to disable the secret rotation using Terraform. Which resource should I use ? The aws_secretsmanager_secret_rotation requires all 3 arguments as shown below and doesn't have any parameter to disable the rotation. The automatically_after_days attribute accepts value between 1 to 365, so, passing 0 is not an option either.

resource "aws_secretsmanager_secret_rotation" "example" { secret_id = aws_secretsmanager_secret.example.id rotation_lambda_arn = aws_lambda_function.example.arn rotation_rules { automatically_after_days = 30 } } 
3

1 Answer

You can just skip "aws_secretsmanager_secret_rotation" resource completely and terraform will disable rotation automatically.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like