Azure 认知服务 - Terraform 中的系统分配标识

Azure Cognitive Services - System assigned identity in Terraform

如何在 Terraform 中创建具有系统分配标识的 Azure 认知服务帐户?

我尝试了以下方法,但出现错误:此处不应包含“identity”类型的块。

resource "azurerm_cognitive_account" "cgsrv" {
  # Conditionally based on feature flag
  count                     = var.to_provision == true ? 1 : 0
  name                      = lower(replace("${var.name_params.prefix}-cgnsrv-${var.name_params.use_case_name}", "-", ""))
  location                  = var.location
  resource_group_name       = var.resourcegroup_name
  kind                      = "CognitiveServices"
  sku_name                  = "S0"

  identity {
    type = "SystemAssigned"
  }
}

你是对的,terraform 文档目前没有提到这个能力(参见 here

提供者是开源的,你可以找到来源here and it looks like there is a pull request regarding this specific field: https://github.com/terraform-providers/terraform-provider-azurerm/pull/12469