diff --git a/infra/.terraform.lock.hcl b/infra/.terraform.lock.hcl index 2fc34da..7ed3a92 100644 --- a/infra/.terraform.lock.hcl +++ b/infra/.terraform.lock.hcl @@ -42,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/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/cae/main.tf b/infra/modules/cae/main.tf index 43efada..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 = { - 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" - }, - ] - } +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" } - response_export_values = ["properties.defaultDomain"] + tags = {} } diff --git a/infra/modules/cae/outputs.tf b/infra/modules/cae/outputs.tf index 1af59d9..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 = 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 598195c..0000000 --- a/infra/modules/cae/providers.tf +++ /dev/null @@ -1,11 +0,0 @@ -terraform { - required_version = ">= 1.4.6" - required_providers { - azurerm = { - source = "hashicorp/azurerm" - } - 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/providers.tf b/infra/providers.tf index 2602cd6..3ff41f1 100644 --- a/infra/providers.tf +++ b/infra/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.87.0" + version = "3.105.0" } azapi = { source = "Azure/azapi"