microsoft-foundry / microsoft-foundry/foundry-samples
Crash: panic: interface conversion: interface {} is nil, not map[string]interface{} when creating AI Foundry (Microsoft.CognitiveServices/accounts)
Nobody has claimed this yet.
- Dominant language
- Bicep
- Stars
- 445
- Forks
- 494
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 38
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the simplified azapi_resource configuration in this issue and reproduce the crash with terraform plan using azapi 2.5.0 and 1.6.1. Investigate how the nested identity and properties values are handled for Microsoft.CognitiveServices/accounts@2025-06-01; done means the resource no longer panics and instead provisions successfully or reports a clear validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, terraform
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100