Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to latest azapi & azurerm terraform providers versions #64

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 29 additions & 28 deletions infra/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
12 changes: 6 additions & 6 deletions infra/modules/apim/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +27,7 @@ resource "azapi_resource" "apim" {
subnetResourceId = var.apim_subnet_id
} : null
}
})
}
response_export_values = [
"identity.principalId",
"properties.gatewayUrl"
Expand All @@ -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"
Expand All @@ -65,7 +65,7 @@ resource "azapi_resource" "apim_backend_pool" {
]
}
}
})
}
}

resource "azurerm_api_management_logger" "appi_logger" {
Expand Down Expand Up @@ -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
}
})
}
}
2 changes: 1 addition & 1 deletion infra/modules/apim/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 0 additions & 2 deletions infra/modules/apim/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.87.0"
}
azapi = {
source = "azure/azapi"
version = "= 1.12.1"
}
}
}
4 changes: 4 additions & 0 deletions infra/modules/appi/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions infra/modules/ca-aihub/auth_config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -42,5 +42,5 @@ resource "azapi_resource" "current" {
preserveUrlFragmentsForLogins = false
}
}
})
}
}
4 changes: 2 additions & 2 deletions infra/modules/ca-aihub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resource "azapi_resource" "ca_back" {
]
}

body = jsonencode({
body = {
properties : {
managedEnvironmentId = "${var.cae_id}"
configuration = {
Expand Down Expand Up @@ -272,7 +272,7 @@ resource "azapi_resource" "ca_back" {
]
}
}
})
}
response_export_values = ["properties.configuration.ingress.fqdn"]
}

Expand Down
2 changes: 1 addition & 1 deletion infra/modules/ca-aihub/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}

1 change: 0 additions & 1 deletion infra/modules/ca-aihub/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.87.0"
}
azapi = {
source = "Azure/azapi"
Expand Down
4 changes: 2 additions & 2 deletions infra/modules/ca-chat/auth_config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -42,5 +42,5 @@ resource "azapi_resource" "current" {
preserveUrlFragmentsForLogins = false
}
}
})
}
}
4 changes: 2 additions & 2 deletions infra/modules/ca-chat/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resource "azapi_resource" "ca_back" {
]
}

body = jsonencode({
body = {
properties : {
managedEnvironmentId = "${var.cae_id}"
configuration = {
Expand Down Expand Up @@ -103,6 +103,6 @@ resource "azapi_resource" "ca_back" {
}
}
}
})
}
response_export_values = ["properties.configuration.ingress.fqdn"]
}
2 changes: 1 addition & 1 deletion infra/modules/ca-chat/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}

1 change: 0 additions & 1 deletion infra/modules/ca-chat/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.87.0"
}
azapi = {
source = "Azure/azapi"
Expand Down
4 changes: 2 additions & 2 deletions infra/modules/ca-plugin-fsi/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -78,5 +78,5 @@ resource "azapi_resource" "ca_function" {
}
httpsOnly = false
}
})
}
}
1 change: 0 additions & 1 deletion infra/modules/ca-plugin-fsi/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.87.0"
}
azapi = {
source = "Azure/azapi"
Expand Down
4 changes: 2 additions & 2 deletions infra/modules/ca-plugin/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -70,5 +70,5 @@ resource "azapi_resource" "ca_function" {
}
httpsOnly = false
}
})
}
}
1 change: 0 additions & 1 deletion infra/modules/ca-plugin/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.87.0"
}
azapi = {
source = "Azure/azapi"
Expand Down
4 changes: 2 additions & 2 deletions infra/modules/ca-prep-docs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resource "azapi_resource" "ca_back" {
]
}

body = jsonencode({
body = {
properties : {
environmentId = "${var.cae_id}"
configuration = {
Expand Down Expand Up @@ -107,7 +107,7 @@ resource "azapi_resource" "ca_back" {
]
}
}
})
}
response_export_values = ["properties.configuration.ingress.fqdn"]
}

Expand Down
1 change: 0 additions & 1 deletion infra/modules/ca-prep-docs/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.87.0"
}
azapi = {
source = "Azure/azapi"
Expand Down
41 changes: 12 additions & 29 deletions infra/modules/cae/main.tf
Original file line number Diff line number Diff line change
@@ -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 = {}
}
4 changes: 2 additions & 2 deletions infra/modules/cae/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}

Loading
Loading