capp
unknown
plain_text
7 months ago
2.1 kB
3
Indexable
Never
terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "~> 3.50" } } } provider "azurerm" { features {} } resource "azurerm_resource_group" "example" { name = "example-resources" location = "East US" } # (ACR) and images data "azurerm_container_registry" "acr" { name = "myAcrName" # Replace with your ACR name resource_group_name = "example-resources" } # Azure Container Apps environment resource "azurerm_container_apps_environment" "example" { name = "example-container-env" resource_group_name = azurerm_resource_group.example.name location = azurerm_resource_group.example.location dynamic_scale { max_replicas = 10 min_replicas = 1 } } # single Azure Container App 'app1' resource "azurerm_container_app" "app1" { name = "app1" resource_group_name = "example-resources" container_apps_environment_id = azurerm_container_apps_environment.example.id template { containers { name = "app1-container" image = "${data.azurerm_container_registry.acr.login_server}/app1:latest" # Use your image path resources { cpu = 1 memory = "2Gi" } env = [ { name = "ENV_VAR1" value = "value1" }, { name = "ENV_VAR2" value = "value2" } ] readiness_probe { http_get { path = "/readiness" port = 8080 } initial_delay_seconds = 10 period_seconds = 5 } liveness_probe { http_get { path = "/liveness" port = 8080 } initial_delay_seconds = 15 period_seconds = 20 } startup_probe { http_get { path = "/startup" port = 8080 } initial_delay_seconds = 10 period_seconds = 5 } } } ingress { external = true target_port = 8080 traffic { weight = 100 latest_revision = true } } }
Leave a Comment