-
Notifications
You must be signed in to change notification settings - Fork 0
/
containers.tf
59 lines (53 loc) · 2.36 KB
/
containers.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
resource "azurerm_cosmosdb_sql_container" "this" {
for_each = var.containers
name = each.value.container_name
resource_group_name = var.resource_group_name
account_name = azurerm_cosmosdb_account.this.name
database_name = each.value.db_name
partition_key_paths = each.value.partition_key_paths
partition_key_version = each.value.partition_key_version != null ? each.value.partition_key_version : 2
throughput = each.value.container_max_throughput != null ? null : each.value.container_throughout
default_ttl = each.value.default_ttl != null ? each.value.default_ttl : null
analytical_storage_ttl = each.value.analytical_storage_ttl != null ? each.value.analytical_storage_ttl : null
dynamic "autoscale_settings" {
for_each = each.value.container_max_throughput != null ? [1] : []
content {
max_throughput = each.value.container_max_throughput
}
}
dynamic "indexing_policy" {
for_each = length(each.value.indexing_policy_settings) > 0 ? [1] : []
content {
indexing_mode = each.value.indexing_policy_settings.indexing_mode != null ? each.value.indexing_policy_settings.indexing_mode : null
dynamic "included_path" {
for_each = each.value.indexing_policy_settings.included_path != null ? [1] : []
content {
path = each.value.indexing_policy_settings.included_path
}
}
dynamic "excluded_path" {
for_each = each.value.indexing_policy_settings.excluded_path != null ? [1] : []
content {
path = each.value.indexing_policy_settings.excluded_path
}
}
}
}
dynamic "unique_key" {
for_each = length(each.value.unique_key) > 0 ? each.value.unique_key : []
content {
paths = each.value.unique_key
}
}
dynamic "conflict_resolution_policy" {
for_each = each.value.conflict_resolution_policy != null ? [1] : []
content {
mode = each.value.conflict_resolution_policy.mode
conflict_resolution_path = each.value.conflict_resolution_policy.mode == "LastWriterWins" ? each.value.conflict_resolution_policy.path : null
conflict_resolution_procedure = each.value.conflict_resolution_policy.mode == "Custom" ? each.value.conflict_resolution_policy.procedure : null
}
}
depends_on = [
azurerm_cosmosdb_sql_database.this
]
}