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

Viewed 746

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
  }
}
1 Answers

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

Related