Skip to content

Commit 13dafcf

Browse files
committed
Set recovery window to 0 on admin connection url secret when non-prod
1 parent eef95e7 commit 13dafcf

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

aws/tf/connection_url.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
resource "aws_secretsmanager_secret" "db_admin_pg" {
2-
name = "${var.name}/conn_url"
3-
tags = var.tags
2+
name = "${var.name}/conn_url"
3+
tags = var.tags
4+
recovery_window_in_days = var.is_prod_env ? 7 : 0
45
}
56

67
resource "aws_secretsmanager_secret_version" "db_admin_pg" {

aws/tf/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ variable "password" {
3535
type = string
3636
}
3737

38+
variable "is_prod_env" {
39+
type = bool
40+
default = true
41+
description = <<EOF
42+
When destroying, is_prod_env determines the recovery window for the admin password secret.
43+
If true, a 7-day recovery window will be configured.
44+
If not, secret will be deleted immediately.
45+
EOF
46+
}
47+
3848
variable "network" {
3949
description = <<EOF
4050
Network configuration.

0 commit comments

Comments
 (0)