Skip to content

Commit

Permalink
Add storage account key to module ca_aihub
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Mar 6, 2024
1 parent 7458352 commit 9de403c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ module "ca_aihub" {
embeddings_deployment = module.openai.embedding_deployment_name
embeddings_model = module.openai.embedding_deployment_name
storage_account_name = module.st.storage_account_name
storage_account_key = module.st.key
storage_container_name = module.st.storage_container_name
search_service_name = module.search.search_service_name
search_index_name = module.search.search_index_name
Expand Down
24 changes: 23 additions & 1 deletion infra/modules/ca-aihub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,36 @@ resource "azapi_resource" "ca_back" {
value = "Development"
}
],
volumeMounts = [
{
volumeName = "customization-volume"
mountPath = "/wwwroot/images/customer"
}
]
},
]
scale = {
minReplicas = 1
maxReplicas = 1
}
},
volumes = [
{
name = "customization-volume"
storageName = "${azurerm_container_app_environment_storage.data.name}"
storageType = "AzureFile"
}
]
}
}
})
response_export_values = ["properties.configuration.ingress.fqdn"]
}

resource "azurerm_container_app_environment_storage" "data" {
name = "customizationstorage"
container_app_environment_id = var.cae_id
account_name = var.storage_account_name
share_name = "customization"
access_key = var.storage_account_key
access_mode = "ReadWrite"
}
1 change: 1 addition & 0 deletions infra/modules/ca-aihub/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ variable "managed_identity_client_id" {}
variable "tenant_id" {}
variable "image_name" {}
variable "storage_account_name" {}
variable "storage_account_key" {}
variable "storage_container_name" {}
variable "search_service_name" {}
variable "search_index_name" {}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions infra/modules/st/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,26 @@ resource "azurerm_storage_share" "share" {
quota = 5
}

resource "azurerm_storage_share" "customization" {
name = "customization"
storage_account_name = azurerm_storage_account.sa.name
quota = 5
}

resource "azurerm_storage_share_file" "docs" {
for_each = fileset("${path.module}/../../../azure-search-openai-demo/data", "*")
name = each.value
storage_share_id = azurerm_storage_share.share.id
source = "${path.module}/../../../azure-search-openai-demo/data/${each.value}"
}

resource "azurerm_storage_share_file" "customization" {
for_each = fileset("${path.module}/customization/customer", "*")
name = each.value
storage_share_id = azurerm_storage_share.customization.id
source = "${path.module}/customization/customer/${each.value}"
}

resource "azurerm_role_assignment" "storage_contributor" {
scope = azurerm_storage_account.sa.id
role_definition_name = "Storage Blob Data Contributor"
Expand Down

0 comments on commit 9de403c

Please sign in to comment.