Terraform 为 linux 个容器创建应用服务

Terraform create app service for linux container

我大家。 我正在尝试使用 terraform 为我的 docker 图像创建一个 azure 应用程序服务,但显然默认情况下此资源是为 windows 创建的,即使我的 app_service_plan 配置为 linux环境。 我的配置如下:

resource "azurerm_app_service_plan" "ASP-name" {
  location = var.location
  name = "ASP-name"
  resource_group_name = <resource-group>
  is_xenon = false
  kind = "Linux"
  maximum_elastic_worker_count = 1
  per_site_scaling = false
  reserved = true
  sku {
    capacity = 1
    size = "P1v2"
    tier = "PremiumV2"
  }
}

resource "azurerm_app_service" "app-name" {
  app_service_plan_id = azurerm_app_service_plan.ASP-name.id
  location = var.location
  name = "app-name"
  resource_group_name = <resource-group>
  app_settings = {
    ASPNETCORE_ENVIRONMENT = "Production"
    "DOCKER_REGISTRY_SERVER_PASSWORD"           = "value"
    "DOCKER_REGISTRY_SERVER_URL"                = "value"
    "DOCKER_REGISTRY_SERVER_USERNAME"           = "value"
  }
  client_affinity_enabled = false
  client_cert_enabled = false
  enabled = true

}

有人可以告诉我我做错了什么吗?

This sample 提供运行单个 Docker 容器的 Linux 应用服务。您需要提供带有 linux_fx_version 的 docker 图片。

resource "azurerm_app_service_plan" "ASP-name" {
  location = var.location
  name = "ASP-name"
  resource_group_name = <resource-group>

  kind = "Linux"
  maximum_elastic_worker_count = 1
  per_site_scaling = false
  reserved = true
  sku {
    capacity = 1
    size = "P1v2"
    tier = "PremiumV2"
  }
}

resource "azurerm_app_service" "app-name" {
  app_service_plan_id = azurerm_app_service_plan.ASP-name.id
  location = var.location
  name = "app-name"
  resource_group_name = <resource-group>

  site_config {
  app_command_line = ""
  linux_fx_version = "DOCKER|appsvcsample/python-helloworld:latest"
}

  app_settings = {
   
    "DOCKER_REGISTRY_SERVER_PASSWORD"           = "value"
    "DOCKER_REGISTRY_SERVER_URL"                = "value"
    "DOCKER_REGISTRY_SERVER_USERNAME"           = "value"
  }
  client_affinity_enabled = false
  client_cert_enabled = false
  enabled = true

}