# Why is Azure's naming convention a nightmare for Terraform?

> Source: <https://promptcube3.com/en/threads/5947/>
> Published: 2026-08-11 20:45:46+00:00

# Why is Azure's naming convention a nightmare for Terraform?

[LangChain](/en/tags/langchain/)agent, and I've hit a wall with the Microsoft Foundry setup. The goal was simple: provision a Foundry hub and a GPT-4o deployment via code so I don't have to click around the portal like it's 2010. Instead, I spent my morning staring at documentation that feels like it was written in riddles.

I managed to get the hub and project standing, but the actual model deployment is where things fall apart. If you've ever tried to "wire up" an LLM in Azure via Terraform, you know the pain of wondering whether you need a specific `azurerm`

resource or if you have to resort to `azapi`

because the official provider is lagging behind the actual API.

Here is the broken state of my config:

```
provider "azurerm" {
  features {}
}

resource "azurerm_ai_foundry" "hub" {
  name                = "my-foundry-hub"
  resource_group_name = azurerm_resource_group.rg.name
  location            = azurerm_resource_group.rg.location
}

resource "azurerm_ai_foundry_project" "project" {
  name              = "my-foundry-project"
  location          = azurerm_ai_foundry.hub.location
  ai_services_hub_id = azurerm_ai_foundry.hub.id
}

# This is where the magic stops and the frustration begins
# I'm missing the actual GPT-4o deployment block
```

The real headache is that I can't figure out if the deployment resource itself exposes the endpoint or if there's some hidden "connection" resource I'm missing to make this callable from an external AI workflow. I'm basically trying to build a production-ready deployment from scratch, but I feel like I'm guessing.

If you've actually succeeded in doing a deep dive into this, I have two specific questions:

1. Which resource block actually works for GPT-4o? Is `azurerm_cognitive_deployment`

the move here, or is that too legacy for the new Foundry Hub structure?

2. Does the deployment automatically create the endpoint, or am I supposed to be hunting for a separate resource to get the API key and URL for my LangChain agent?

I'm hoping for a practical tutorial or even just a snippet that doesn't result in a `ResourceNotFound`

error. If anyone has a working deployment pattern that doesn't involve praying to the Azure gods, please share.

[Next Unsloth Desktop finally lets us train models locally without a →](/en/threads/5937/)
