Skip to content

Commit

Permalink
Add cognitive deployment (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindelmont authored Nov 19, 2024
1 parent 60668ad commit 4ccbe99
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/standalone-scenarios-additional.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"config_files": [
"cognitive_services/100-cognitive-services-account",
"cognitive_services/101-cognitive-services-account-managed-identity",
"cognitive_services/200-cognitive-services-deployment",
"compute/batch/batch_certificate/100-batch-certificate - path",
"compute/batch/batch_job/100-batch-job - quotas",
"compute/batch/batch_pool/100-batch-pool - quotas",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
global_settings = {
default_region = "region1"
regions = {
region1 = "westus"
}
random_length = 5
}

resource_groups = {
test-rg = {
name = "rg-alz-caf-test-1"
}
}

cognitive_services_account = {
test_account-1 = {
resource_group = {
# accepts either id or key to get resource group id
# id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1"
# lz_key = "examples"
key = "test-rg"
}
name = "cs-alz-caf-test-1"
kind = "OpenAI"
sku_name = "S0"
tags = {
env = "test"
}
# you must first agree to the Responsible AI terms for that resource type in your Azure subscription. This is a legal agreement that must be accepted in the Azure Portal before you can proceed with deployment via Terraform.
# https://learn.microsoft.com/en-us/legal/cognitive-services/openai/limited-access
deployment = {
gpt-35-turbo = {
name = "gpt-35-turbo"
model = {
name = "gpt-35-turbo"
format = "OpenAI"
version = "0301"
}
scale = {
type = "Standard"
capacity = 1
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,28 @@ resource "azurerm_cognitive_account" "service" {
}
}
}
}
}

resource "azurerm_cognitive_deployment" "deployment" {
depends_on = [azurerm_cognitive_account.service]

for_each = var.settings.deployment
name = each.value.name
cognitive_account_id = azurerm_cognitive_account.service.id
rai_policy_name = try(each.value.rai_policy, null)
version_upgrade_option = try(each.value.version_upgrade_option, null)

model {
name = each.value.model.name
format = each.value.model.format
version = try(each.value.model.version, null)
}

scale {
type = each.value.scale.type
tier = try(each.value.scale.tier, null)
size = try(each.value.scale.size, null)
family = try(each.value.scale.family, null)
capacity = try(each.value.scale.capacity, null)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ output "rbac_id" {
output "identity" {
value = try(azurerm_cognitive_account.service.identity, null)
}

output "deployment_id" {
description = "The ID of the Deployment for Azure Cognitive Services Account."
value = azurerm_cognitive_deployment.id
}

0 comments on commit 4ccbe99

Please sign in to comment.