-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
58 lines (45 loc) · 1.68 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
resource "yandex_mdb_redis_cluster" "this" {
name = var.name
description = var.description
environment = var.environment
network_id = var.network_id
folder_id = var.folder_id
persistence_mode = var.persistence_mode
deletion_protection = var.deletion_protection
sharded = var.sharded
tls_enabled = var.tls_enabled
config {
password = var.password
version = var.redis_version
databases = var.databases
timeout = var.timeout
maxmemory_policy = var.maxmemory_policy
notify_keyspace_events = var.notify_keyspace_events
slowlog_log_slower_than = var.slowlog_log_slower_than
slowlog_max_len = var.slowlog_max_len
client_output_buffer_limit_normal = var.client_output_buffer_limit_normal
client_output_buffer_limit_pubsub = var.client_output_buffer_limit_pubsub
}
resources {
resource_preset_id = var.resource_preset_id
disk_size = var.disk_size
disk_type_id = var.disk_type_id
}
dynamic "host" {
for_each = var.hosts
content {
zone = lookup(host.value, "zone", var.zone)
subnet_id = lookup(host.value, "subnet_id", var.subnet_id)
shard_name = var.sharded ? "shard-${host.key}" : null
replica_priority = var.sharded ? null : var.replica_priority
assign_public_ip = var.tls_enabled ? lookup(host.value, "assign_public_ip", var.assign_public_ip) : false
}
}
security_group_ids = var.security_group_ids
#labels = var.labels
maintenance_window {
type = var.type
hour = var.type == "ANYTIME" ? null : var.hour
day = var.type == "ANYTIME" ? null : var.day
}
}