|
| 1 | +resource "azurerm_container_app_environment" "lissi_eventplanner" { |
| 2 | + name = "cae-${local.stack}" |
| 3 | + location = azurerm_resource_group.lissi_eventplanner.location |
| 4 | + resource_group_name = azurerm_resource_group.lissi_eventplanner.name |
| 5 | + log_analytics_workspace_id = azurerm_log_analytics_workspace.lissi_eventplanner.id |
| 6 | + tags = local.default_tags |
| 7 | +} |
| 8 | + |
| 9 | +resource "azurerm_container_app" "lissi_eventplanner" { |
| 10 | + name = "ca-${local.stack}" |
| 11 | + container_app_environment_id = azurerm_container_app_environment.lissi_eventplanner.id |
| 12 | + resource_group_name = azurerm_resource_group.lissi_eventplanner.name |
| 13 | + revision_mode = "Single" |
| 14 | + tags = local.default_tags |
| 15 | + |
| 16 | + ingress { |
| 17 | + allow_insecure_connections = true |
| 18 | + external_enabled = true |
| 19 | + target_port = 80 |
| 20 | + |
| 21 | + traffic_weight { |
| 22 | + percentage = 100 |
| 23 | + latest_revision = true |
| 24 | + } |
| 25 | + |
| 26 | + # custom_domain { |
| 27 | + # name = var.domain |
| 28 | + # certificate_id = data.azurerm_key_vault_certificate.ssl_certificate.id |
| 29 | + # certificate_binding_type = "SniEnabled" |
| 30 | + # } |
| 31 | + } |
| 32 | + |
| 33 | + lifecycle { |
| 34 | + // Required to not delete the manually created custom domain since it is not possible to create a managed certificate for a custom domain with terraform |
| 35 | + // https://github.com/hashicorp/terraform-provider-azurerm/issues/21866 |
| 36 | + ignore_changes = ["ingress"] |
| 37 | + } |
| 38 | + |
| 39 | + template { |
| 40 | + min_replicas = 1 |
| 41 | + max_replicas = 1 |
| 42 | + |
| 43 | + container { |
| 44 | + name = "eventplanner" |
| 45 | + image = "ghcr.io/grossherzogin-elisabeth/eventplanner:main" |
| 46 | + cpu = 0.5 |
| 47 | + memory = "1Gi" |
| 48 | + env { |
| 49 | + name = "AUTH_ISSUER_URI" |
| 50 | + value = "https://login.microsoftonline.com/63384ddf-6496-44bd-b22c-93e944e6ed88/v2.0" |
| 51 | + } |
| 52 | + env { |
| 53 | + name = "AUTH_CLIENT_ID" |
| 54 | + secret_name = "client-id" |
| 55 | + } |
| 56 | + env { |
| 57 | + name = "AUTH_CLIENT_SECRET" |
| 58 | + secret_name = "client-secret" |
| 59 | + } |
| 60 | + env { |
| 61 | + name = "SERVER_HOST" |
| 62 | + value = var.domain |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + secret { |
| 68 | + name = "client-id" |
| 69 | + value = data.azurerm_key_vault_secret.client_id.value |
| 70 | + } |
| 71 | + |
| 72 | + secret { |
| 73 | + name = "client-secret" |
| 74 | + value = data.azurerm_key_vault_secret.client_secret.value |
| 75 | + } |
| 76 | +} |
0 commit comments