Konubinix' opinionated web of thoughts

Delete a Secrets Manager Secret and Create a New Secret With the Same Name

Fleeting

Secrets Manager schedules the secret for deletion after a recovery window with a minimum of seven days. You can’t create a secret with the previously used name on the Secrets Manager console until the recovery window ends. To immediately delete a secret without the recovery window, use the AWS Command Line Interface (AWS CLI). For more information, see Delete an AWS Secrets Manager secret.

https://repost.aws/knowledge-center/delete-secrets-manager-secret ([2025-04-07 Mon])

aws secretsmanager list-secrets --include-planned-deletion
aws secretsmanager delete-secret --secret-id your-secret-name --force-delete-without-recovery

with terraform

You need to set the recovery window to 0 for immediate deletion of secrets

[…]

recovery_window_in_days - (Optional) Specifies the number of days that AWS Secrets Manager waits before it can delete the secret. This value can be 0 to force deletion without recovery or range from 7 to 30 days. The default value is 30.

https://stackoverflow.com/questions/57431731/terraform-secrets-manager-reuse-of-existing-secrets-without-deleting ([2025-04-07 Mon])