updating modules
This commit is contained in:
71
modules/container_app/container_app.tf
Normal file
71
modules/container_app/container_app.tf
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
resource "azurerm_container_app" "container_app_app" {
|
||||||
|
name = var.container_app_name
|
||||||
|
container_app_environment_id = var.container_app_environment_id
|
||||||
|
resource_group_name = data.azurerm_resource_group.resource_group.name
|
||||||
|
revision_mode = "Single"
|
||||||
|
|
||||||
|
registry {
|
||||||
|
server = var.registry_server_name
|
||||||
|
username = var.registry_username
|
||||||
|
password_secret_name = var.registry_password_secret_name
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
min_replicas = var.template_min_replicas
|
||||||
|
max_replicas = var.template_max_replicas
|
||||||
|
|
||||||
|
dynamic "init_container" {
|
||||||
|
for_each = var.init_containers
|
||||||
|
content {
|
||||||
|
name = init_container.value["name"]
|
||||||
|
image = container.value["image"]
|
||||||
|
cpu = init_container.value["cpu"]
|
||||||
|
memory = init_container.value["memory"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "container" {
|
||||||
|
for_each = var.containers
|
||||||
|
content {
|
||||||
|
name = container.value["name"]
|
||||||
|
image = container.value["image"]
|
||||||
|
cpu = container.value["cpu"]
|
||||||
|
memory = container.value["memory"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress {
|
||||||
|
allow_insecure_connections = var.ingress_allow_insecure_connections
|
||||||
|
external_enabled = var.ingress_external_enabled
|
||||||
|
target_port = var.ingress_target_port
|
||||||
|
transport = var.ingress_transport
|
||||||
|
|
||||||
|
traffic_weight {
|
||||||
|
latest_revision = true
|
||||||
|
percentage = var.traffic_weight_percentage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "secret" {
|
||||||
|
for_each = var.secrets
|
||||||
|
content {
|
||||||
|
name = secret.value["name"]
|
||||||
|
value = secret.value["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
ignore_changes = [ template[0].container[0].image ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_container_app_custom_domain" "custom_domain" {
|
||||||
|
count = var.custom_domain_count
|
||||||
|
name = trimsuffix(trimprefix(azurerm_dns_txt_record.dns_txt_record[0].fqdn, "asuid."), ".")
|
||||||
|
container_app_id = azurerm_container_app.container_app_app.id
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
ignore_changes = [ certificate_binding_type, container_app_environment_certificate_id ]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
resource "azurerm_container_app" "container_app_api" {
|
|
||||||
name = var.container_app_api_name
|
|
||||||
container_app_environment_id = azurerm_container_app_environment.container_app_environment.id
|
|
||||||
resource_group_name = data.azurerm_resource_group.resource_group.name
|
|
||||||
revision_mode = "Single"
|
|
||||||
|
|
||||||
registry {
|
|
||||||
server = "index.docker.io"
|
|
||||||
username = var.docker_io_username
|
|
||||||
password_secret_name = "docker-io-password"
|
|
||||||
}
|
|
||||||
|
|
||||||
template {
|
|
||||||
min_replicas = 0
|
|
||||||
max_replicas = 2
|
|
||||||
|
|
||||||
container {
|
|
||||||
name = var.container_app_api_container_name
|
|
||||||
image = var.container_app_api_container_image
|
|
||||||
cpu = 0.25
|
|
||||||
memory = "0.5Gi"
|
|
||||||
|
|
||||||
env {
|
|
||||||
name = "AZURE_STORAGE_CONNECTION_STRING"
|
|
||||||
secret_name = "azure-storage-connection-string"
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
|
||||||
name = "CLIENT_ID"
|
|
||||||
secret_name = "client-id"
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
|
||||||
name = "CLIENT_SECRET"
|
|
||||||
secret_name = "client-secret"
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
|
||||||
name = "TENANT_ID"
|
|
||||||
secret_name = "tenant-id"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ingress {
|
|
||||||
allow_insecure_connections = false
|
|
||||||
external_enabled = true
|
|
||||||
target_port = 3000
|
|
||||||
transport = "auto"
|
|
||||||
|
|
||||||
traffic_weight {
|
|
||||||
latest_revision = true
|
|
||||||
percentage = 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
secret {
|
|
||||||
name = "docker-io-password"
|
|
||||||
value = var.docker_io_password
|
|
||||||
}
|
|
||||||
|
|
||||||
secret {
|
|
||||||
name = "azure-storage-connection-string"
|
|
||||||
value = var.storage_account_primary_connection_string
|
|
||||||
}
|
|
||||||
|
|
||||||
secret {
|
|
||||||
name = "client-id"
|
|
||||||
value = var.client_id
|
|
||||||
}
|
|
||||||
|
|
||||||
secret {
|
|
||||||
name = "client-secret"
|
|
||||||
value = var.client_secret
|
|
||||||
}
|
|
||||||
|
|
||||||
secret {
|
|
||||||
name = "tenant-id"
|
|
||||||
value = var.tenant_id
|
|
||||||
}
|
|
||||||
|
|
||||||
lifecycle {
|
|
||||||
ignore_changes = [ template[0].container[0].image ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
resource "azurerm_container_app" "container_app_app" {
|
|
||||||
name = var.container_app_app_name
|
|
||||||
container_app_environment_id = azurerm_container_app_environment.container_app_environment.id
|
|
||||||
resource_group_name = data.azurerm_resource_group.resource_group.name
|
|
||||||
revision_mode = "Single"
|
|
||||||
|
|
||||||
registry {
|
|
||||||
server = "index.docker.io"
|
|
||||||
username = var.docker_io_username
|
|
||||||
password_secret_name = "docker-io-password"
|
|
||||||
}
|
|
||||||
|
|
||||||
template {
|
|
||||||
min_replicas = 0
|
|
||||||
max_replicas = 2
|
|
||||||
|
|
||||||
container {
|
|
||||||
name = var.container_app_app_container_name
|
|
||||||
image = var.container_app_app_container_image
|
|
||||||
cpu = 0.25
|
|
||||||
memory = "0.5Gi"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ingress {
|
|
||||||
allow_insecure_connections = false
|
|
||||||
external_enabled = true
|
|
||||||
target_port = 8080
|
|
||||||
transport = "auto"
|
|
||||||
|
|
||||||
traffic_weight {
|
|
||||||
latest_revision = true
|
|
||||||
percentage = 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
secret {
|
|
||||||
name = "docker-io-password"
|
|
||||||
value = var.docker_io_password
|
|
||||||
}
|
|
||||||
|
|
||||||
lifecycle {
|
|
||||||
ignore_changes = [ template[0].container[0].image ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "azurerm_container_app_custom_domain" "custom_domain" {
|
|
||||||
count = var.custom_domain_count
|
|
||||||
name = trimsuffix(trimprefix(azurerm_dns_txt_record.dns_txt_record[0].fqdn, "asuid."), ".")
|
|
||||||
container_app_id = azurerm_container_app.container_app_app.id
|
|
||||||
|
|
||||||
lifecycle {
|
|
||||||
ignore_changes = [ certificate_binding_type, container_app_environment_certificate_id ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,40 +2,21 @@ variable "app_subdomain_name" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "client_id" {
|
variable "containers" {
|
||||||
|
type = list(object({
|
||||||
|
name = string
|
||||||
|
image = string
|
||||||
|
cpu = string
|
||||||
|
memory = string
|
||||||
|
}))
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "container_app_name" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "client_secret" {
|
variable "container_app_environment_id" {
|
||||||
sensitive = true
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "container_app_app_name" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "container_app_app_container_image" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "container_app_app_container_name" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "container_app_api_name" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "container_app_api_container_image" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "container_app_api_container_name" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "container_app_environment_name" {
|
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,12 +24,22 @@ variable "custom_domain_count" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "docker_io_password" {
|
variable "init_containers" {
|
||||||
|
default = []
|
||||||
|
type = list(object({
|
||||||
|
name = string
|
||||||
|
image = string
|
||||||
|
cpu = string
|
||||||
|
memory = string
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "registry_password" {
|
||||||
sensitive = true
|
sensitive = true
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "docker_io_username" {
|
variable "registry_username" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +51,32 @@ variable "dns_zone_resource_group" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "log_analytics_workspace_name" {
|
variable "ingress_external_enabled" {
|
||||||
|
default = false
|
||||||
|
type = bool
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ingress_allow_insecure_connections" {
|
||||||
|
default = false
|
||||||
|
type = bool
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ingress_target_port" {
|
||||||
|
type = number
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ingress_transport" {
|
||||||
|
default = "auto"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "registry_password_secret_name" {
|
||||||
|
default = "docker-io-password"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "registry_server_name" {
|
||||||
|
default = "index.docker.io"
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,10 +84,29 @@ variable "resource_group_name" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "secrets" {
|
||||||
|
default = []
|
||||||
|
type = list(object({
|
||||||
|
name = string
|
||||||
|
value = string
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
variable "storage_account_primary_connection_string" {
|
variable "storage_account_primary_connection_string" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "tenant_id" {
|
variable "traffic_weight_percentage" {
|
||||||
type = string
|
default = 100
|
||||||
|
type = number
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "template_min_replicas" {
|
||||||
|
default = 0
|
||||||
|
type = number
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "template_max_replicas" {
|
||||||
|
default = 1
|
||||||
|
type = number
|
||||||
}
|
}
|
||||||
2
modules/container_app_environment/client_config.tf
Normal file
2
modules/container_app_environment/client_config.tf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
data "azurerm_client_config" "current" {
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@ resource "azurerm_log_analytics_workspace" "log_analytics_workspace" {
|
|||||||
name = var.log_analytics_workspace_name
|
name = var.log_analytics_workspace_name
|
||||||
location = data.azurerm_resource_group.resource_group.location
|
location = data.azurerm_resource_group.resource_group.location
|
||||||
resource_group_name = data.azurerm_resource_group.resource_group.name
|
resource_group_name = data.azurerm_resource_group.resource_group.name
|
||||||
sku = "PerGB2018"
|
sku = var.log_analytics_workspace_sku
|
||||||
retention_in_days = 30
|
retention_in_days = var.log_analytics_workspace_retention_in_days
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_container_app_environment" "container_app_environment" {
|
resource "azurerm_container_app_environment" "container_app_environment" {
|
||||||
3
modules/container_app_environment/resource_group.tf
Normal file
3
modules/container_app_environment/resource_group.tf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
data "azurerm_resource_group" "resource_group" {
|
||||||
|
name = var.resource_group_name
|
||||||
|
}
|
||||||
20
modules/container_app_environment/variables.tf
Normal file
20
modules/container_app_environment/variables.tf
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
variable "container_app_environment_name" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "log_analytics_workspace_name" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "log_analytics_workspace_retention_in_days" {
|
||||||
|
default = 30
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "log_analytics_workspace_sku" {
|
||||||
|
default = "PerGB2018"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "resource_group_name" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
3
modules/dns/resource_group.tf
Normal file
3
modules/dns/resource_group.tf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
data "azurerm_resource_group" "resource_group" {
|
||||||
|
name = var.resource_group_name
|
||||||
|
}
|
||||||
19
modules/dns/variables.tf
Normal file
19
modules/dns/variables.tf
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
variable "app_subdomain_name" {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "custom_domain_count" {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dns_zone_resource_group" {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "domain_name" {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "resource_group_name" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user