updating modules

This commit is contained in:
2025-08-23 09:22:51 -05:00
parent 597dd42da6
commit cbb8b677cf
9 changed files with 88 additions and 15 deletions

View File

@@ -22,6 +22,24 @@ resource "azurerm_container_app" "container_app_app" {
image = container.value["image"] image = container.value["image"]
memory = init_container.value["memory"] memory = init_container.value["memory"]
name = init_container.value["name"] name = init_container.value["name"]
dynamic "env" {
for_each = container.value["envs"] != null ? container.value["envs"] : []
content {
name = env.value["name"]
secret_name = env.value["secret_name"]
value = env.value["value"]
}
}
dynamic "volume_mounts" {
for_each = container.value["volume_mounts"] != null ? container.value["volume_mounts"] : []
content {
name = volume_mount.value["name"]
path = volumn_mount.value["path"]
sub_path = volume_mount.value["sub_path"] != null ? volume_mount.value["sub_path"] : null
}
}
} }
} }
@@ -47,11 +65,21 @@ resource "azurerm_container_app" "container_app_app" {
for_each = container.value["volume_mounts"] != null ? container.value["volume_mounts"] : [] for_each = container.value["volume_mounts"] != null ? container.value["volume_mounts"] : []
content { content {
name = volume_mount.value["name"] name = volume_mount.value["name"]
path = volumn_mount.value["path"] path = volume_mount.value["path"]
sub_path = volume_mount.value["sub_path"] != null ? volume_mount.value["sub_path"] : null
} }
} }
} }
} }
dynamic "volume" {
for_each = var.volume
content {
name = volume.value["name"]
storage_type = volume.value["storage_type"]
storage_name = volume.value["storage_name"]
}
}
} }
ingress { ingress {

View File

@@ -19,6 +19,7 @@ variable "containers" {
volume_mounts = optional(list(object({ volume_mounts = optional(list(object({
name = string name = string
path = string path = string
sub_path = optional(string)
}))) })))
})) }))
} }
@@ -82,6 +83,7 @@ variable "init_containers" {
volume_mounts = optional(list(object({ volume_mounts = optional(list(object({
name = string name = string
path = string path = string
sub_path = optional(string)
}))) })))
})) }))
} }
@@ -136,3 +138,13 @@ variable "template_max_replicas" {
default = 1 default = 1
type = number type = number
} }
variable "volume" {
default = []
type = list(object({
name = string
storage_type = string
storage_name = string
share_name = string
}))
}

View File

@@ -0,0 +1,2 @@
data "azurerm_client_config" "current" {
}

View File

@@ -0,0 +1,8 @@
resource "azurerm_container_app_environment_storage" "container_app_environment_storage" {
name = var.name
container_app_environment_id = var.container_app_environment_id
account_name = var.storage_account_name
share_name = var.share_name
access_key = var.storage_account_access_key
access_mode = var.access_mode
}

View File

@@ -0,0 +1,23 @@
variable "access_mode" {
type = string
}
variable "container_app_environment_id" {
type = string
}
variable "name" {
type = string
}
variable "share_name" {
type = string
}
variable "storage_account_access_key" {
type = string
}
variable "storage_account_name" {
type = string
}

View File

@@ -1,3 +1,7 @@
output "storage_account_primary_connection_string" { output "storage_account_primary_connection_string" {
value = azurerm_storage_account.storage_account.primary_connection_string value = azurerm_storage_account.storage_account.primary_connection_string
} }
output "storage_account_name" {
value = azurerm_storage_account.storage_account.name
}

View File

@@ -1,6 +0,0 @@
resource "azurerm_storage_account_static_website" "static_website" {
count = length(var.static_websites)
storage_account_id = azurerm_storage_account.storage_account.id
error_404_document = var.static_websites[count.index].error_404_document
index_document = var.static_websites[count.index].index_document
}

View File

@@ -0,0 +1,5 @@
resource "azure_storage_share" "storage_share" {
count = length(var.storage_shares)
name = var.storage_shares[count.index]
storage_account_name = azurerm_storage_account.storage_account.name
}

View File

@@ -12,14 +12,6 @@ variable "resource_group_name" {
type = string type = string
} }
variable "static_websites" {
default = []
type = list(object({
error_404_document = string
index_document = string
}))
}
variable "storage_account_name" { variable "storage_account_name" {
type = string type = string
} }
@@ -45,6 +37,11 @@ variable "storage_queues" {
type = list(string) type = list(string)
} }
variable "storage_shares" {
default = []
type = list(string)
}
variable "storage_tables" { variable "storage_tables" {
default = [] default = []
type = list(string) type = list(string)