Skip to content

Commit a469e7e

Browse files
9 add recovery window in days (#11)
* Update main.tf added recovery_window_in_days to resource * Update variables.tf added variable for recovery_window_in_days * Update README.md * Update README.md fixed default value * Update README.md removed from example
1 parent 865c8d0 commit a469e7e

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Example:
88

99
```
1010
module "random_password" {
11-
source = "git::https://github.com/rhythmictech/terraform-aws-secretsmanager-secret"
12-
name_prefix = "RDSPassword"
13-
description = "RDS instance master password"
14-
length = 20
15-
override_special = "@#$%^*()-=_+[]{};<>?,./"
11+
source = "git::https://github.com/rhythmictech/terraform-aws-secretsmanager-secret"
12+
name_prefix = "RDSPassword"
13+
description = "RDS instance master password"
14+
length = 20
15+
override_special = "@#$%^*()-=_+[]{};<>?,./"
1616
}
1717
```
1818

@@ -48,6 +48,7 @@ module "random_password" {
4848
| name\_prefix | Name Prefix (not used if name specified) | `string` | `"terraform"` | no |
4949
| override\_special | n/a | `string` | `""` | no |
5050
| pass\_version | Password version. Increment this to trigger a new password. | `number` | `1` | no |
51+
| recovery_window_in_days | Number of days to wait before deleting the secret | `number` | `"30"` | no |
5152
| secret\_access\_metric\_namespace | Metric namespace to use for CloudWatch metric | `string` | `"SecretsManager"` | no |
5253
| secret\_access\_notification\_arn | SNS topic to notify on secret access (required if `enable_secret_access_notification=true`) | `string` | `""` | no |
5354
| tags | Tags to add to supported resources | `map(string)` | `{}` | no |

main.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ resource "random_password" "random_string" {
2323
}
2424

2525
resource "aws_secretsmanager_secret" "secret" {
26-
count = var.create_secret ? 1 : 0
27-
name = var.name == "" ? null : var.name
28-
name_prefix = var.name == "" ? var.name_prefix : null
29-
description = var.description
30-
kms_key_id = var.kms_key_id
31-
tags = var.tags
26+
count = var.create_secret ? 1 : 0
27+
name = var.name == "" ? null : var.name
28+
name_prefix = var.name == "" ? var.name_prefix : null
29+
description = var.description
30+
kms_key_id = var.kms_key_id
31+
recovery_window_in_days = var.recovery_window_in_days
32+
tags = var.tags
3233
}
3334

3435
resource "aws_secretsmanager_secret_version" "secret_val" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ variable "pass_version" {
3636
type = number
3737
}
3838

39+
variable "recovery_window_in_days" {
40+
default = 30
41+
description = "Number of days that AWS Secrets Manager waits before it can delete the secret."
42+
type = number
43+
}
44+
3945
variable "tags" {
4046
default = {}
4147
description = "Tags to add to supported resources"

0 commit comments

Comments
 (0)