generated from cloudposse/terraform-example-module
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
asm.tf
33 lines (24 loc) · 1.25 KB
/
asm.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
28
29
30
31
32
33
resource "aws_secretsmanager_secret" "certificate" {
count = local.asm_enabled ? 1 : 0
name = format(var.secret_path_format, module.this.id, var.secret_extensions.certificate)
recovery_window_in_days = var.asm_recovery_window_in_days
kms_key_id = local.certificate_backend_kms_key_id
tags = module.this.tags
}
resource "aws_secretsmanager_secret_version" "certificate" {
count = local.asm_enabled ? 1 : 0
secret_id = join("", aws_secretsmanager_secret.certificate.*.name)
secret_string = var.certificate_backends_base64_enabled ? base64encode(local.tls_certificate) : local.tls_certificate
}
resource "aws_secretsmanager_secret" "private_key" {
count = local.asm_enabled ? 1 : 0
name = format(var.secret_path_format, module.this.id, var.secret_extensions.private_key)
recovery_window_in_days = var.asm_recovery_window_in_days
kms_key_id = local.certificate_backend_kms_key_id
tags = module.this.tags
}
resource "aws_secretsmanager_secret_version" "private_key" {
count = local.asm_enabled ? 1 : 0
secret_id = join("", aws_secretsmanager_secret.private_key.*.name)
secret_string = var.certificate_backends_base64_enabled ? base64encode(local.tls_key) : local.tls_key
}