Skip to content

Commit 5441b48

Browse files
authored
Clean up terraform samples (#328)
* aoai template * azurerm basic sample * update one at a time * clean up samples * remove tags
1 parent b18d33f commit 5441b48

File tree

4 files changed

+25
-29
lines changed

4 files changed

+25
-29
lines changed

samples/microsoft/infrastructure-setup-terraform/00-basic-azurerm/code/providers.tf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# Setup providers
2-
provider "azapi" {
3-
}
4-
52
provider "azurerm" {
63
features {}
74
storage_use_azuread = true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
location = "eastus2"
1+
location = "eastus"

samples/microsoft/infrastructure-setup-terraform/00-basic/code/main.tf

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Create a random string
22
##
33
resource "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" {
2425
resource "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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
# Setup providers
22
provider "azapi" {
3-
}
4-
5-
provider "azurerm" {
6-
features {}
7-
storage_use_azuread = true
8-
}
3+
}

0 commit comments

Comments
 (0)