azureterraform-provider-azureazure-ai

How to create Azure AI services multi-service account using Terraform


I am aware of Azure openai service can be created using azurerm_cognitive_account.

resource "azurerm_cognitive_account" "openai_services" {
  for_each                      = { for openai in var.openai_services : openai.name => openai }
  name                          = each.value.name
  location                      = each.value.location
  resource_group_name           = each.value.resource_group_name
  kind                          = "OpenAI"
  sku_name                      = each.value.sku_name
  public_network_access_enabled = each.value.public_network_access_enabled
  identity {
    type = "SystemAssigned"
  }
  tags = merge(var.default_tags, each.value.tags)
}

However, I am unware if facility exist for multi-service in Azure Terraform provider.

How to create Azure AI services multi-service account using Terraform?


Solution

  • It is called azurerm_cognitive_account

    Docs link: https://learn.microsoft.com/en-us/azure/ai-services/create-account-terraform?tabs=azure-cli

    
    resource "azurerm_cognitive_account" "cognitive_service" {
      name                = "CognitiveService-${random_string.azurerm_cognitive_account_name.result}"
      location            = azurerm_resource_group.rg.location
      resource_group_name = azurerm_resource_group.rg.name
      sku_name            = var.sku
      kind                = "CognitiveServices"
    }