Hello team,
When trying to provision an Azure AI Foundry resource (Microsoft.CognitiveServices/accounts@2025-06-01) using the azapi provider, Terraform crashes with the following panic:
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine XXXX [running]:
github.com/zclconf/go-cty/cty.Value.GetAttr(0x2cbab38, 0xc00225b1b0, 0x0, 0x0, 0xc000d6d870, 0xa, 0x2cbaa58, 0xc000056428, 0x0, 0x0)
.../cty/value_ops.go:760 +0x416
github.com/hashicorp/terraform/internal/plans/objchange.proposedNewAttributes(...)
.../internal/plans/objchange/objchange.go:267
This is not just a validation error — it’s a Terraform crash.
Steps to Reproduce
Create a resource with this config (simplified example):
resource "azapi_resource" "ai_foundry" {
type = "Microsoft.CognitiveServices/accounts@2025-06-01"
name = "aift-test-dev-001"
parent_id = "/subscriptions//resourceGroups/"
location = "Sweden Central"
identity {
type = "SystemAssigned"
}
body = {
kind = "AIServices"
sku = {
name = "S0"
}
properties = {
disableLocalAuth = false
allowProjectManagement = true
customSubDomainName = "test123"
}
}
}
Run terraform plan
Expected Behavior
Terraform should create the Microsoft.CognitiveServices/accounts resource successfully or return a clear schema validation error.
Actual Behavior
Terraform crashes with panic: interface conversion: interface {} is nil, not map[string]interface{}.
Environment
Provider version: azapi: 2.5.0 also 1.6.1
Additional Notes
It seems related to how azapi is handling nested identity or properties in this API version.
Please advise if this is a known issue or if there is a workaround.