-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathr-cosmosdb.tf
86 lines (71 loc) · 2.81 KB
/
r-cosmosdb.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
resource "azurerm_cosmosdb_account" "main" {
name = local.name
location = var.location
resource_group_name = var.resource_group_name
offer_type = var.offer_type
kind = var.kind
mongo_server_version = var.kind == "MongoDB" ? var.mongo_server_version : null
free_tier_enabled = var.free_tier_enabled
automatic_failover_enabled = true
analytical_storage_enabled = var.analytical_storage_enabled
dynamic "analytical_storage" {
for_each = var.analytical_storage_type[*]
content {
schema_type = analytical_storage.value
}
}
dynamic "geo_location" {
for_each = var.failover_locations != null ? var.failover_locations : local.default_failover_locations
content {
location = geo_location.value.location
failover_priority = lookup(geo_location.value, "priority", 0)
zone_redundant = lookup(geo_location.value, "zone_redundant", false)
}
}
consistency_policy {
consistency_level = var.consistency_policy_level
max_interval_in_seconds = var.consistency_policy_max_interval_in_seconds
max_staleness_prefix = var.consistency_policy_max_staleness_prefix
}
dynamic "capabilities" {
for_each = toset(var.capabilities)
content {
name = capabilities.key
}
}
ip_range_filter = var.allowed_cidrs
public_network_access_enabled = var.public_network_access_enabled
is_virtual_network_filter_enabled = var.is_virtual_network_filter_enabled
network_acl_bypass_for_azure_services = var.network_acl_bypass_for_azure_services_enabled
network_acl_bypass_ids = var.network_acl_bypass_ids
dynamic "virtual_network_rule" {
for_each = var.virtual_network_rule != null ? toset(var.virtual_network_rule) : []
content {
id = virtual_network_rule.value.id
ignore_missing_vnet_service_endpoint = virtual_network_rule.value.ignore_missing_vnet_service_endpoint
}
}
dynamic "backup" {
for_each = var.backup != null ? ["enabled"] : []
content {
type = lookup(var.backup, "type", null)
tier = lookup(var.backup, "tier", null)
interval_in_minutes = lookup(var.backup, "interval_in_minutes", null)
retention_in_hours = lookup(var.backup, "retention_in_hours", null)
storage_redundancy = lookup(var.backup, "storage_redundancy", null)
}
}
dynamic "identity" {
for_each = var.identity_type[*]
content {
type = identity.value
# Avoid perpetual changes if SystemAssigned and identity_ids is not null
identity_ids = endswith(identity.value, "UserAssigned") ? var.identity_ids : null
}
}
tags = merge(local.default_tags, var.extra_tags)
}
moved {
from = azurerm_cosmosdb_account.db
to = azurerm_cosmosdb_account.main
}