capp2
unknown
plain_text
a year ago
2.7 kB
9
Indexable
terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "~> 3.0" } } } provider "azurerm" { features {} } resource "azurerm_resource_group" "example" { name = "example-resources" location = "West Europe" } # Fetch the ACR details data "azurerm_container_registry" "acr" { name = "yourAcrName" resource_group_name = "yourResourceGroupName" } resource "azurerm_log_analytics_workspace" "example" { name = "example-analytics-workspace" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name sku = "PerGB2018" retention_in_days = 30 } resource "azurerm_container_apps_environment" "example" { name = "example-environment" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id } # Example Container App using an image from ACR resource "azurerm_container_app" "example_app" { name = "example-app" resource_group_name = azurerm_resource_group.example.name container_app_environment_id = azurerm_container_apps_environment.example.id revision_mode = "Single" template { container { name = "example-container" image = "${data.azurerm_container_registry.acr.login_server}/yourImageName:tag" cpu = 1 memory = "2Gi" # Example env vars env = [ { name = "EXAMPLE_ENV_VAR" value = "exampleValue" }, { name = "ENV_VAR2" value = "value2" }, ] probe { type = "liveness" http_get { path = "/health" port = 80 } initial_delay_seconds = 30 period_seconds = 60 } probe { type = "readiness" http_get { path = "/health" port = 80 } initial_delay_seconds = 10 period_seconds = 30 } probe { type = "startup" http_get { path = "/health" port = 80 } initial_delay_seconds = 10 period_seconds = 30 } } } scale { min_replicas = 1 max_replicas = 10 rules { name = "httpscalingrule" type = "Http" metadata = { concurrent_requests = "50" } } } ingress { external = true target_port = 80 traffic { weight = 100 latest_revision = true } } }
Editor is loading...
Leave a Comment