11# # Create a random string
22# #
33resource "random_string" "unique" {
4- length = 4
5- min_numeric = 4
4+ length = 5
5+ min_numeric = 5
66 numeric = true
77 special = false
88 lower = true
@@ -11,9 +11,10 @@ resource "random_string" "unique" {
1111
1212# # Create a resource group for the resources to be stored in
1313# #
14- resource "azurerm_resource_group" "rg" {
15- name = " rg-aifoundry${ random_string . unique . result } "
16- location = var. location
14+ resource "azapi_resource" "rg" {
15+ type = " Microsoft.Resources/resourceGroups@2021-04-01"
16+ name = " rg-aifoundry-${ random_string . unique . result } "
17+ location = var. location
1718}
1819
1920# ######### Create AI Foundry resource
@@ -24,7 +25,7 @@ resource "azurerm_resource_group" "rg" {
2425resource "azapi_resource" "ai_foundry" {
2526 type = " Microsoft.CognitiveServices/accounts@2025-06-01"
2627 name = " aifoundry${ random_string . unique . result } "
27- parent_id = azurerm_resource_group . rg . name
28+ parent_id = azapi_resource . rg . id
2829 location = var. location
2930 schema_validation_enabled = false
3031
@@ -52,23 +53,26 @@ resource "azapi_resource" "ai_foundry" {
5253
5354# # Create a deployment for OpenAI's GPT-4o in the AI Foundry resource
5455# #
55- resource "azurerm_cognitive_deployment" "aifoundry_deployment_gpt_4o" {
56+ resource "azapi_resource" "aifoundry_deployment_gpt_4o" {
57+ type = " Microsoft.CognitiveServices/accounts/deployments@2023-05-01"
58+ name = " gpt-4o"
59+ parent_id = azapi_resource. ai_foundry . id
5660 depends_on = [
5761 azapi_resource . ai_foundry
5862 ]
5963
60- name = " gpt-4o "
61- cognitive_account_id = azapi_resource . ai_foundry . id
62-
63- sku {
64- name = " GlobalStandard "
65- capacity = 1
66- }
67-
68- model {
69- format = " OpenAI "
70- name = " gpt-4o "
71- version = " 2024-11-20 "
64+ body = {
65+ sku = {
66+ name = " GlobalStandard "
67+ capacity = 1
68+ }
69+ properties = {
70+ model = {
71+ format = " OpenAI "
72+ name = " gpt-4o "
73+ version = " 2024-11-20 "
74+ }
75+ }
7276 }
7377}
7478
0 commit comments