# Container Apps An app in a Log Analytics-backed environment, with a user-assigned identity, HTTP ingress and scaling limits. ```hcl variable "image" { type = string } variable "identity_id" { type = string } resource "azurerm_log_analytics_workspace" "main" { name = "log-workload" location = var.location resource_group_name = var.resource_group_name retention_in_days = 30 } resource "azurerm_container_app_environment" "main" { name = "cae-workload" location = var.location resource_group_name = var.resource_group_name log_analytics_workspace_id = azurerm_log_analytics_workspace.main.id } resource "azurerm_container_app" "api" { name = "ca-api" container_app_environment_id = azurerm_container_app_environment.main.id resource_group_name = var.resource_group_name revision_mode = "Single" identity { type = "UserAssigned" identity_ids = [var.identity_id] } ingress { external_enabled = true target_port = 8080 traffic_weight { latest_revision = true percentage = 100 } } template { min_replicas = 2 max_replicas = 10 container { name = "api" image = var.image cpu = 0.5 memory = "1Gi" } } } ```