generated from wellcomecollection/terraform-aws-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
27 lines (21 loc) · 904 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
locals {
# By default, Secrets Manager will "soft" delete secrets -- they're
# no longer accessible to applications, but they can still be recovered.
# This is useful if you delete a secret accidentally, but also
# means the secret hangs around and you can't create a new secret
# with the same ID immediately.
#
# See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret#recovery_window_in_days
recovery_window_in_days = var.deletion_mode == "IMMEDIATE" ? 0 : 30
}
resource "aws_secretsmanager_secret" "secret" {
for_each = var.key_value_map
name = each.key
description = var.description
recovery_window_in_days = local.recovery_window_in_days
}
resource "aws_secretsmanager_secret_version" "secret" {
for_each = var.key_value_map
secret_id = aws_secretsmanager_secret.secret[each.key].id
secret_string = each.value
}