Skip to content

Commit 0564181

Browse files
authored
Merge pull request #21 from scribd/vadimka/support-deletion-period
Add delete_in argument
2 parents 9115edb + 483985a commit 0564181

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ A module to create application secrets stored in [AWS Secrets Manager](https://a
1111
* [Cross-account secrets](#cross-account-secrets)
1212
* [Inputs](#inputs)
1313
* [Secrets](#secrets)
14+
* [Recovery window](#recovery-window)
1415
* [Outputs](#outputs)
1516
* [Release](#release)
1617
* [Maintainers](#maintainers)
@@ -210,12 +211,13 @@ module "user" {
210211
211212
## Inputs
212213

213-
| Name | Description | Type | Default | Required |
214-
|:-------------|:---------------------------------------|:-------------|:------------|:---------|
215-
| `app_name` | Application name | string | `null` | yes |
216-
| `aws_region` | AWS region | string | `us-east-2` | no |
217-
| `secrets` | List of objects of [secrets](#secrets) | list(object) | `null` | yes |
218-
| `tags` | Key-value map of tags | map(string) | `{}` | no |
214+
| Name | Description | Type | Default | Required |
215+
|:-------------|:------------------------------------------------------------------|:-------------|:------------|:---------|
216+
| `app_name` | Application name | string | `null` | yes |
217+
| `aws_region` | AWS region | string | `us-east-2` | no |
218+
| `secrets` | List of objects of [secrets](#secrets) | list(object) | `null` | yes |
219+
| `delete_in` | [Number of days](#recovery-window) to wait before secret deletion | number | `30` | no |
220+
| `tags` | Key-value map of tags | map(string) | `{}` | no |
219221

220222
### Secrets
221223

@@ -225,6 +227,10 @@ module "user" {
225227
| `value` | Secret value | string | `null` |
226228
| `allowed_arns` | List of principal ARNs that have access to the secret | list | `null` |
227229

230+
### Recovery window
231+
232+
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`.
233+
228234
## Outputs
229235

230236
| Name | Description | Sensitive |

main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ resource "aws_secretsmanager_secret" "app" {
2424

2525
policy = lookup(local.arns, each.key, null) == null ? null : data.aws_iam_policy_document.access[each.key].json
2626

27+
recovery_window_in_days = var.delete_in
28+
2729
tags = merge(var.tags, { "service" = var.app_name })
2830
}
2931

variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ variable "secrets" {
2121
)
2222
}
2323

24+
variable "delete_in" {
25+
description = "Number of days to wait before secret deletion"
26+
type = number
27+
28+
default = 30
29+
30+
validation {
31+
condition = var.delete_in == 0 || contains(range(7, 30), var.delete_in)
32+
error_message = "The delete_in value must be 0 or between 7 and 30."
33+
}
34+
}
35+
2436
variable "tags" {
2537
description = "Key-value map of tags"
2638
type = map(string)

0 commit comments

Comments
 (0)