Skip to content

Commit

Permalink
Update module configurations for latest aihub version
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Feb 27, 2024
1 parent 87b34fd commit 55d1f3e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
18 changes: 9 additions & 9 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ module "openai" {
}

module "cog" {
source = "./modules/cog"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
resource_group_id = azurerm_resource_group.rg.id
principal_id = module.mi.principal_id
bing_name = local.bing_name
cognitive_services_name = local.cognitive_services_name
content_safety_name = local.content_safety_name
speech_name = local.speech_name
source = "./modules/cog"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
resource_group_id = azurerm_resource_group.rg.id
bing_name = local.bing_name
cognitive_services_name = local.cognitive_services_name
content_safety_name = local.content_safety_name
speech_name = local.speech_name
content_safety_storage_resource_id = module.st.storage_account_id
}

module "cae" {
Expand Down
16 changes: 16 additions & 0 deletions infra/modules/ca-aihub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ resource "azapi_resource" "ca_back" {
name = "BrandAnalyzer__OpenAISubscriptionKey",
value = ""
},
{
name = "BrandAnalyzer__DeploymentName",
value = "DemoBuild"
},
{
name = "CallCenter__OpenAIEndpoint",
value = "${var.openai_endpoint}"
Expand All @@ -106,6 +110,10 @@ resource "azapi_resource" "ca_back" {
name = "CallCenter__OpenAISubscriptionKey",
value = ""
},
{
name = "CallCenter__DeploymentName",
value = "DemoBuild"
},
{
name = "ImageAnalyzer__VisionEndpoint",
value = "${var.cognitive_service_endpoint}computervision/imageanalysis:analyze?api-version=2023-02-01-preview&features=denseCaptions&language=en&gender-neutral-caption=False"
Expand All @@ -130,6 +138,10 @@ resource "azapi_resource" "ca_back" {
name = "ImageAnalyzer__ContainerName",
value = "image-analyzer"
},
{
name = "ImageAnalyzer__DeploymentName",
value = "DemoBuild"
},
{
name = "FormAnalyzer__FormRecogEndpoint",
value = "${var.cognitive_service_endpoint}formrecognizer/documentModels/prebuilt-layout:analyze?api-version=2023-07-31"
Expand All @@ -150,6 +162,10 @@ resource "azapi_resource" "ca_back" {
name = "FormAnalyzer__ContainerName",
value = "form-analyzer"
},
{
name = "FormAnalyzer__DeploymentName",
value = "DemoBuild"
},
{
name = "Storage__ConnectionString",
secretRef = "storage-connection-string"
Expand Down
15 changes: 8 additions & 7 deletions infra/modules/cog/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ resource "azurerm_cognitive_account" "content_safety" {
resource_group_name = var.resource_group_name
public_network_access_enabled = true
custom_subdomain_name = var.content_safety_name
identity {
type = "SystemAssigned"
}
}

resource "azurerm_cognitive_account" "cognitive" {
Expand Down Expand Up @@ -47,10 +50,8 @@ resource "azapi_resource" "bing" {
response_export_values = ["properties.endpoint"]
}



# resource "azurerm_role_assignment" "openai_user" {
# scope = azurerm_cognitive_account.openai.id
# role_definition_name = "Cognitive Services OpenAI User"
# principal_id = var.principal_id
# }
resource "azurerm_role_assignment" "reader" {
scope = var.content_safety_storage_resource_id
role_definition_name = "Storage Blob Data Reader"
principal_id = azurerm_cognitive_account.content_safety.identity[0].principal_id
}
2 changes: 1 addition & 1 deletion infra/modules/cog/variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
variable "resource_group_name" {}
variable "resource_group_id" {}
variable "location" {}
variable "principal_id" {}
variable "content_safety_name" {}
variable "cognitive_services_name" {}
variable "speech_name" {}
variable "bing_name" {}
variable "content_safety_storage_resource_id" {}
4 changes: 4 additions & 0 deletions infra/modules/st/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ output "connection_string" {
output "key" {
value = azurerm_storage_account.sa.primary_access_key
}

output "storage_account_id" {
value = azurerm_storage_account.sa.id
}
4 changes: 2 additions & 2 deletions infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ variable "use_random_suffix" {
}

variable "enable_entra_id_authentication" {
default = false
default = true
}

variable "enable_apim" {
default = false
default = true
}

variable "bing_key" {
Expand Down

0 comments on commit 55d1f3e

Please sign in to comment.