diff --git a/infra/.terraform.lock.hcl b/infra/.terraform.lock.hcl index 39dc5c3..7ed3a92 100644 --- a/infra/.terraform.lock.hcl +++ b/infra/.terraform.lock.hcl @@ -2,21 +2,22 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/azure/azapi" { - version = "1.12.1" + version = "1.13.1" + constraints = "1.13.1" hashes = [ - "h1:H9n5gOhlN5GT5WIhasUbxIONS/6BfRP9ES1oQop2wxk=", - "zh:1cf52e685ceb04e73e13fbf3f3036bff23a3274a4ceda8693c0612076a588166", - "zh:321b59c2a67c6cb4e5cf0dbe2cc978f5389d781e8b391f9b75bf4d830abd2ffe", - "zh:49046bd8020c3b44c6b5dc67041f181e4fff45e3bc1a9ff0646dd20c21c8ce47", - "zh:5784d0c326ec4825571577bc39b253019bd3b1030c19d67ca3436df2d7ba01c8", - "zh:5ad7e18d26f170c01888d8e65dab7aa475089aac7bf0106526fd57cdd56533bc", - "zh:6695854f4f655673bea85e37444bf0c070b440dba4bc269aa144d0f6b7c1cc5f", - "zh:7f372c897da6b9ad90869a8eb85b37dad4dff2d5d311b3eca1a2e6373e2271ed", - "zh:8afa1a2be1dada4e8be4ab72d9d56f36af1e486c9353d04aabf6e79db7310125", - "zh:90809364619238c45185bff25c7d9c4fde34253561d8183ebbe797456c44bc9c", - "zh:9338d44650c9e68e10a6bc2d69f7beacd5059e6ac681d2e388e80a1652d9c183", - "zh:c94ee6fb1df2c1d35f338107b5e73cdba86c4ecf9dcde95e2ca0132cbbd4bd7c", - "zh:de231d363b1a664c6b5d3af8d3b9cf542d04d4506fb9458ba6c8ebf94e0e32ae", + "h1:Q10vF78s0i71/CfRYbeoRLAWuJrat2kxIrHK9/yaEYk=", + "zh:1f2aceddd67ceeb82a75c2f15dc01e54781e9aed5968507dbc29590c165b2e2b", + "zh:397f0bfbac899d48e23cecf38d362c27562150aa20b19157b5bd370b8e6801ee", + "zh:652263b7d00623684e29ef7b8ff285a17c5bd7cc8ba7d22967c66d0b3a3c568a", + "zh:652c53320a41434942877515780296a1509be03f32d54e60178f39200f960a67", + "zh:666426faf686401e54ec09fe06e9d7c06a6455ec398764f70558440c73aeb7f9", + "zh:6aa91ae8ba78f2494f99b4c99e66d15ed0b14d735cd1f77adc12ff9dfa075807", + "zh:a529e5a13c37d1805c469227f08cdbe7527d04dd64d18709d26627c6a0b588b1", + "zh:a589c049205e8e5bf94a13d56b28f400d908ad27e13e16df64408ee82eb8a0ff", + "zh:a9a50defdee230f315f74be6c77ff104fe2610a1b3ad6b87326f555e80d13b18", + "zh:ba49ef70d96e13795e2dbffd6cb2ff976dfe84e0373a5971ebe3b4c9c9b7af60", + "zh:d3ed50efe5f8c80d3d7d464ab9a13ccf82440d871c9ce3032ce476845364c6b9", + "zh:e3eb48ee8c36ee4f81850d8a21fc59b81886c729d7c3b7adece4a25f355bed2f", ] } @@ -41,21 +42,21 @@ provider "registry.terraform.io/hashicorp/azuread" { } provider "registry.terraform.io/hashicorp/azurerm" { - version = "3.87.0" - constraints = "3.87.0" + version = "3.105.0" + constraints = "3.105.0" hashes = [ - "h1:SqFtup3wvbozutkXVF78LylpKL4nGED1cbk2IbLzhAQ=", - "zh:1547ed020fa6ca25d940b28601442c7e4495fdea9fb1ead7affb867383f5f40b", - "zh:325e6d636b5ab09a24837194647617c9fabd42f0fb2c7e18ae8d2a8b2d890a55", - "zh:3abb0074de1dc3b723f8c209354ba93e717ba52003847484b19369e8f54735f4", - "zh:52d2b1700108d5093113a986aa10757834e48083c1358a2c7d8d0360e2689390", - "zh:5fe377d5cc80e26766ff411dbcb227728709fe34b14ad106c9e374df653086a4", - "zh:747fe80de4fb88b17cac93ff05d62909d3563325c8ed5a461641b48579c328f8", - "zh:b40142e4041b7f000ab2dda58309755395a4018d5d00218f6a601f737389865a", - "zh:bca622818c221cec81d636879e376c15696a8d091703298195d728b3c1eae7db", - "zh:bfaecd203137ff9eb3228b1cbd3191e1d84d7c019855eb5f3071bbf6eb060a51", - "zh:d197f04b54f2be07f827ced220954d723039c84793a4ce91894b622982c25811", - "zh:e831601ea1f67c5e745946ed3ac0cac772ed8e95ca7d7314d3f0ed631e6eefb1", + "h1:MK83TecMdabDD+HjbxdTt3emXp8G6djLj7KvvUGstM0=", + "zh:2f81bca6a3bf3d37604bf99fdb2c77d6118520aa379ab65fd28e6b76bed399cd", + "zh:3578eb79d175af9544b0dc543124d551c0fed4c48f51773ee17e1dc62e22833a", + "zh:377dbb56caea3fa1e6a6599193b55c8594204c40c054fc2ace4f576fdfe750a2", + "zh:3d1cf01929cb213ff9a0f9753e35699bf13f60f7f0f15b38f1b216fa2cbb5f72", + "zh:481376d79224a0e4aebc6e39dee10de3cc14efd1c7c58b6d74c538e356cf4bb2", + "zh:625119aec0d24ff693c589d802b7983ffce3fcf1e9c3351396af02799dd176ca", + "zh:65981e62a6e9eb8a39dd332632617e8c929dcce6af48d3829f590f5c0f14362f", + "zh:72db82697f4e694c21defa8d0efb22f71d373676d078d71d567e8b4d9a134df7", + "zh:a0fa43cf78716ff98eccd7506b017c5c487034d9d9cce88c1accdba9314a4822", + "zh:b073f60b68b0102128815251dd895ec7f24bddec84a1b725fc0777de8a78dc7e", + "zh:b601e509eb9735756b6b7ccacc15d6333769a7bb2f8ac8c394e39b29cfc6ee55", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", ] } diff --git a/infra/main.tf b/infra/main.tf index 8329b35..710bf36 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -165,14 +165,13 @@ module "cog" { } module "cae" { - source = "./modules/cae" - location = azurerm_resource_group.rg.location - resource_group_id = azurerm_resource_group.rg.id - cae_name = local.cae_name - cae_subnet_id = module.vnet.cae_subnet_id - log_workspace_id = module.log.log_workspace_id - log_key = module.log.log_key - appi_key = module.appi.appi_key + source = "./modules/cae" + location = azurerm_resource_group.rg.location + resource_group_name = azurerm_resource_group.rg.name + cae_name = local.cae_name + cae_subnet_id = module.vnet.cae_subnet_id + log_id = module.log.log_id + appi_connection_string = module.appi.appi_connection_string } module "ca_chat" { diff --git a/infra/modules/apim/main.tf b/infra/modules/apim/main.tf index 359a487..8fd4cd6 100644 --- a/infra/modules/apim/main.tf +++ b/infra/modules/apim/main.tf @@ -12,7 +12,7 @@ resource "azapi_resource" "apim" { type = "SystemAssigned" } schema_validation_enabled = false # requiered for now - body = jsonencode({ + body = { sku = { name = "StandardV2" capacity = 1 @@ -27,7 +27,7 @@ resource "azapi_resource" "apim" { subnetResourceId = var.apim_subnet_id } : null } - }) + } response_export_values = [ "identity.principalId", "properties.gatewayUrl" @@ -51,7 +51,7 @@ resource "azapi_resource" "apim_backend_pool" { parent_id = azapi_resource.apim.id name = "openai-backend-pool" schema_validation_enabled = false # requiered for now - body = jsonencode({ + body = { properties = { description = "Azure OpenAI Backend Pool" type = "Pool" @@ -65,7 +65,7 @@ resource "azapi_resource" "apim_backend_pool" { ] } } - }) + } } resource "azurerm_api_management_logger" "appi_logger" { @@ -231,10 +231,10 @@ resource "azapi_update_resource" "diagnostics" { type = "Microsoft.ApiManagement/service/diagnostics@2022-08-01" resource_id = azurerm_api_management_diagnostic.diagnostics.id - body = jsonencode({ + body = { properties = { loggerId = azurerm_api_management_logger.appi_logger.id metrics = true } - }) + } } diff --git a/infra/modules/apim/outputs.tf b/infra/modules/apim/outputs.tf index e8aaf5d..7cbc903 100644 --- a/infra/modules/apim/outputs.tf +++ b/infra/modules/apim/outputs.tf @@ -3,5 +3,5 @@ output "apim_name" { } output "gateway_url" { - value = jsondecode(azapi_resource.apim.output).properties.gatewayUrl + value = azapi_resource.apim.output.properties.gatewayUrl } \ No newline at end of file diff --git a/infra/modules/apim/providers.tf b/infra/modules/apim/providers.tf index 5f51d2f..ed0ab78 100644 --- a/infra/modules/apim/providers.tf +++ b/infra/modules/apim/providers.tf @@ -2,11 +2,9 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" } azapi = { source = "azure/azapi" - version = "= 1.12.1" } } } diff --git a/infra/modules/appi/outputs.tf b/infra/modules/appi/outputs.tf index 9afcc00..b11dbc0 100644 --- a/infra/modules/appi/outputs.tf +++ b/infra/modules/appi/outputs.tf @@ -5,3 +5,7 @@ output "appi_id" { output "appi_key" { value = azurerm_application_insights.appinsights.instrumentation_key } + +output "appi_connection_string" { + value = azurerm_application_insights.appinsights.connection_string +} diff --git a/infra/modules/ca-aihub/auth_config.tf b/infra/modules/ca-aihub/auth_config.tf index b98d84b..1ecb980 100644 --- a/infra/modules/ca-aihub/auth_config.tf +++ b/infra/modules/ca-aihub/auth_config.tf @@ -13,7 +13,7 @@ resource "azapi_resource" "current" { name = "Current" parent_id = azapi_resource.ca_back.id timeouts {} - body = jsonencode({ + body = { properties = { platform = { enabled = true @@ -42,5 +42,5 @@ resource "azapi_resource" "current" { preserveUrlFragmentsForLogins = false } } - }) + } } diff --git a/infra/modules/ca-aihub/main.tf b/infra/modules/ca-aihub/main.tf index 9c62fbb..8694d71 100644 --- a/infra/modules/ca-aihub/main.tf +++ b/infra/modules/ca-aihub/main.tf @@ -10,7 +10,7 @@ resource "azapi_resource" "ca_back" { ] } - body = jsonencode({ + body = { properties : { managedEnvironmentId = "${var.cae_id}" configuration = { @@ -272,7 +272,7 @@ resource "azapi_resource" "ca_back" { ] } } - }) + } response_export_values = ["properties.configuration.ingress.fqdn"] } diff --git a/infra/modules/ca-aihub/outputs.tf b/infra/modules/ca-aihub/outputs.tf index 80cb417..58778ab 100644 --- a/infra/modules/ca-aihub/outputs.tf +++ b/infra/modules/ca-aihub/outputs.tf @@ -1,4 +1,4 @@ output "fqdn" { - value = jsondecode(azapi_resource.ca_back.output).properties.configuration.ingress.fqdn + value = azapi_resource.ca_back.output.properties.configuration.ingress.fqdn } diff --git a/infra/modules/ca-aihub/providers.tf b/infra/modules/ca-aihub/providers.tf index 6473e13..598195c 100644 --- a/infra/modules/ca-aihub/providers.tf +++ b/infra/modules/ca-aihub/providers.tf @@ -3,7 +3,6 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" } azapi = { source = "Azure/azapi" diff --git a/infra/modules/ca-chat/auth_config.tf b/infra/modules/ca-chat/auth_config.tf index b98d84b..1ecb980 100644 --- a/infra/modules/ca-chat/auth_config.tf +++ b/infra/modules/ca-chat/auth_config.tf @@ -13,7 +13,7 @@ resource "azapi_resource" "current" { name = "Current" parent_id = azapi_resource.ca_back.id timeouts {} - body = jsonencode({ + body = { properties = { platform = { enabled = true @@ -42,5 +42,5 @@ resource "azapi_resource" "current" { preserveUrlFragmentsForLogins = false } } - }) + } } diff --git a/infra/modules/ca-chat/main.tf b/infra/modules/ca-chat/main.tf index 78623e0..4a7eb2c 100644 --- a/infra/modules/ca-chat/main.tf +++ b/infra/modules/ca-chat/main.tf @@ -10,7 +10,7 @@ resource "azapi_resource" "ca_back" { ] } - body = jsonencode({ + body = { properties : { managedEnvironmentId = "${var.cae_id}" configuration = { @@ -103,6 +103,6 @@ resource "azapi_resource" "ca_back" { } } } - }) + } response_export_values = ["properties.configuration.ingress.fqdn"] } diff --git a/infra/modules/ca-chat/outputs.tf b/infra/modules/ca-chat/outputs.tf index 80cb417..58778ab 100644 --- a/infra/modules/ca-chat/outputs.tf +++ b/infra/modules/ca-chat/outputs.tf @@ -1,4 +1,4 @@ output "fqdn" { - value = jsondecode(azapi_resource.ca_back.output).properties.configuration.ingress.fqdn + value = azapi_resource.ca_back.output.properties.configuration.ingress.fqdn } diff --git a/infra/modules/ca-chat/providers.tf b/infra/modules/ca-chat/providers.tf index 6473e13..598195c 100644 --- a/infra/modules/ca-chat/providers.tf +++ b/infra/modules/ca-chat/providers.tf @@ -3,7 +3,6 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" } azapi = { source = "Azure/azapi" diff --git a/infra/modules/ca-plugin-fsi/main.tf b/infra/modules/ca-plugin-fsi/main.tf index e92ff87..ae102cd 100644 --- a/infra/modules/ca-plugin-fsi/main.tf +++ b/infra/modules/ca-plugin-fsi/main.tf @@ -13,7 +13,7 @@ resource "azapi_resource" "ca_function" { location = var.location parent_id = var.resource_group_id type = "Microsoft.Web/sites@2023-01-01" - body = jsonencode({ + body = { kind = "functionapp,linux,container,azurecontainerapps" properties : { language = "dotnet-isolated" @@ -78,5 +78,5 @@ resource "azapi_resource" "ca_function" { } httpsOnly = false } - }) + } } diff --git a/infra/modules/ca-plugin-fsi/providers.tf b/infra/modules/ca-plugin-fsi/providers.tf index ae7c762..489ffe6 100644 --- a/infra/modules/ca-plugin-fsi/providers.tf +++ b/infra/modules/ca-plugin-fsi/providers.tf @@ -3,7 +3,6 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" } azapi = { source = "Azure/azapi" diff --git a/infra/modules/ca-plugin/main.tf b/infra/modules/ca-plugin/main.tf index 9958f70..6c21586 100644 --- a/infra/modules/ca-plugin/main.tf +++ b/infra/modules/ca-plugin/main.tf @@ -13,7 +13,7 @@ resource "azapi_resource" "ca_function" { location = var.location parent_id = var.resource_group_id type = "Microsoft.Web/sites@2023-01-01" - body = jsonencode({ + body = { kind = "functionapp,linux,container,azurecontainerapps" properties : { language = "dotnet-isolated" @@ -70,5 +70,5 @@ resource "azapi_resource" "ca_function" { } httpsOnly = false } - }) + } } diff --git a/infra/modules/ca-plugin/providers.tf b/infra/modules/ca-plugin/providers.tf index ae7c762..489ffe6 100644 --- a/infra/modules/ca-plugin/providers.tf +++ b/infra/modules/ca-plugin/providers.tf @@ -3,7 +3,6 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" } azapi = { source = "Azure/azapi" diff --git a/infra/modules/ca-prep-docs/main.tf b/infra/modules/ca-prep-docs/main.tf index cdda45d..4e86a27 100644 --- a/infra/modules/ca-prep-docs/main.tf +++ b/infra/modules/ca-prep-docs/main.tf @@ -10,7 +10,7 @@ resource "azapi_resource" "ca_back" { ] } - body = jsonencode({ + body = { properties : { environmentId = "${var.cae_id}" configuration = { @@ -107,7 +107,7 @@ resource "azapi_resource" "ca_back" { ] } } - }) + } response_export_values = ["properties.configuration.ingress.fqdn"] } diff --git a/infra/modules/ca-prep-docs/providers.tf b/infra/modules/ca-prep-docs/providers.tf index 6473e13..598195c 100644 --- a/infra/modules/ca-prep-docs/providers.tf +++ b/infra/modules/ca-prep-docs/providers.tf @@ -3,7 +3,6 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" } azapi = { source = "Azure/azapi" diff --git a/infra/modules/cae/main.tf b/infra/modules/cae/main.tf index f100526..c48ad7a 100644 --- a/infra/modules/cae/main.tf +++ b/infra/modules/cae/main.tf @@ -1,30 +1,13 @@ -resource "azapi_resource" "cae" { - name = var.cae_name - location = var.location - parent_id = var.resource_group_id - type = "Microsoft.App/managedEnvironments@2022-11-01-preview" - - body = jsonencode({ - properties : { - daprAIInstrumentationKey = "${var.appi_key}" - appLogsConfiguration = { - destination = "log-analytics" - logAnalyticsConfiguration = { - customerId = "${var.log_workspace_id}" - sharedKey = "${var.log_key}" - } - } - vnetConfiguration = { - internal = false - infrastructureSubnetId = "${var.cae_subnet_id}" - } - workloadProfiles = [ - { - workloadProfileType = "Consumption" - name = "Consumption" - }, - ] - } - }) - response_export_values = ["properties.defaultDomain"] +resource "azurerm_container_app_environment" "cae" { + name = var.cae_name + resource_group_name = var.resource_group_name + location = var.location + dapr_application_insights_connection_string = var.appi_connection_string + log_analytics_workspace_id = var.log_id + infrastructure_subnet_id = var.cae_subnet_id + workload_profile { + name = "Consumption" + workload_profile_type = "Consumption" + } + tags = {} } diff --git a/infra/modules/cae/outputs.tf b/infra/modules/cae/outputs.tf index 94868ce..2d7a014 100644 --- a/infra/modules/cae/outputs.tf +++ b/infra/modules/cae/outputs.tf @@ -1,8 +1,8 @@ output "cae_id" { - value = azapi_resource.cae.id + value = azurerm_container_app_environment.cae.id } output "default_domain" { - value = jsondecode(azapi_resource.cae.output).properties.defaultDomain + value = azurerm_container_app_environment.cae.default_domain } diff --git a/infra/modules/cae/providers.tf b/infra/modules/cae/providers.tf deleted file mode 100644 index 6473e13..0000000 --- a/infra/modules/cae/providers.tf +++ /dev/null @@ -1,12 +0,0 @@ -terraform { - required_version = ">= 1.4.6" - required_providers { - azurerm = { - source = "hashicorp/azurerm" - version = "3.87.0" - } - azapi = { - source = "Azure/azapi" - } - } -} diff --git a/infra/modules/cae/variables.tf b/infra/modules/cae/variables.tf index ef3b3df..ba6bb85 100644 --- a/infra/modules/cae/variables.tf +++ b/infra/modules/cae/variables.tf @@ -1,7 +1,6 @@ -variable "resource_group_id" {} +variable "resource_group_name" {} variable "location" {} variable "cae_name" {} variable "cae_subnet_id" {} -variable "log_workspace_id" {} -variable "log_key" {} -variable "appi_key" {} +variable "log_id" {} +variable "appi_connection_string" {} diff --git a/infra/modules/cog/providers.tf b/infra/modules/cog/providers.tf index 6473e13..598195c 100644 --- a/infra/modules/cog/providers.tf +++ b/infra/modules/cog/providers.tf @@ -3,7 +3,6 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" } azapi = { source = "Azure/azapi" diff --git a/infra/providers.tf b/infra/providers.tf index fd6d59e..3ff41f1 100644 --- a/infra/providers.tf +++ b/infra/providers.tf @@ -3,11 +3,11 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" + version = "3.105.0" } azapi = { source = "Azure/azapi" - version = "1.12.1" + version = "1.13.1" } azuread = { source = "hashicorp/azuread"