-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
63 lines (48 loc) · 1.31 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
resource "google_secret_manager_secret" "secret" {
count = var.module_enabled ? 1 : 0
depends_on = [var.module_depends_on]
secret_id = var.secret_id
labels = var.labels
expire_time = var.expire_time
ttl = var.ttl
project = var.project
dynamic "replication" {
for_each = length(var.replicas) == 0 ? ["automatic"] : []
content {
auto {
}
}
}
dynamic "replication" {
for_each = length(var.replicas) > 0 ? ["user_managed"] : []
content {
user_managed {
dynamic "replicas" {
for_each = var.replicas
content {
location = replicas.value.location
dynamic "customer_managed_encryption" {
for_each = try([replicas.value.customer_managed_encryption], [])
content {
kms_key_name = customer_managed_encryption.value.kms_key_name
}
}
}
}
}
}
}
dynamic "topics" {
for_each = var.topics != null ? var.topics : []
content {
name = topics.value
}
}
dynamic "rotation" {
for_each = var.rotation != null ? ["rotation"] : []
content {
next_rotation_time = try(var.rotation.next_rotation_time, null)
rotation_period = try(var.rotation.rotation_period, null)
}
}
}