My code is this:
data “azurerm_resource_group” “chads-rg” {
name = “chads-rg”
}
data “azurerm_user_assigned_identity” “mongo_db” {
name = “mongo_db”
resource_group_name = data.azurerm_resource_group.chads-rg.name
}
output “Assigned_ID” {
value = data.azurerm_user_assigned_identity.mongo_db.principal_id
}
resource “azurerm_resource_group” “chads-rg” {
name = “chads-rg”
location = “EastUS”
}
/*
resource “random_integer” “ri” {
min = 10000
max = 99999
}
*/
resource “azurerm_cosmosdb_account” “db” {
#name = “tfex-cosmos-db-${random_integer.ri.result}”
name = “chads-mongo-db”
location = data.azurerm_resource_group.chads-rg.location
resource_group_name = data.azurerm_resource_group.chads-rg.name
offer_type = “Standard”
kind = “MongoDB”
#Following lines added
network_acl_bypass_for_azure_services = true
mongo_server_version = 4.2
#enable_free_tier = false
#public_network_access_enabled = false
enable_automatic_failover = true
capabilities {
name = “EnableAggregationPipeline”
}
capabilities {
name = “mongoEnableDocLevelTTL”
}
capabilities {
name = “MongoDBv3.4”
}
capabilities {
name = “EnableMongo”
}
consistency_policy {
consistency_level = “BoundedStaleness”
max_interval_in_seconds = 300
max_staleness_prefix = 100000
}
geo_location {
location = “eastus”
failover_priority = 1
}
geo_location {
location = “westus”
failover_priority = 0
}
#following blocks added
backup {
type = “Periodic”
interval_in_minutes = 120
retention_in_hours = 72
storage_redundancy = “Local”
}
timeouts{
create = “60m”
delete = “60m”
}
identity {
type = “UserAssigned”
#identity_ids = d9b84fb8-4f2f-4130-8326-33047f3d4ca0
identity_ids = data.azurerm_user_assigned_identity.mongo_db.principal_id
}
default_identity_type = “UserAssignedIdentity=d9b84fb8-4f2f-4130-8326-33047f3d4ca0”
key_vault_key_id = “https://chads-keyvault.vault.azure.net/keys/cosmos-mongo-db/” #<–Keyvault URI
}
It throws the following error. I can not seem to get the identity_ids in the identity block formatted correct. Whats missing?