Собственный провайдер Pulumi Azure: Azure WebApp: параметр LinuxFxVersion имеет недопустимое значение.

Я создал новую программу Pulumi Typescript с помощью Pulumi CLI с pulumi new azure-typescript и создал следующий index.ts (на основе нового собственный поставщик Azure):

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure-native";

const resourceGroup = new azure.resources.ResourceGroup("rg-spring-boot", {location: "West Europe"});

const appServicePlan = new azure.web.AppServicePlan("sp-spring-boot", {
    location: resourceGroup.location,
    resourceGroupName: resourceGroup.name,
    kind: "Linux",
    sku: {
        name: "B1",
        tier: "Basic",
    },
});

// Image https://hub.docker.com/r/jonashackt/spring-boot-vuejs
const imageName = "jonashackt/spring-boot-vuejs:latest";

const appServiceSpringBoot = new azure.web.WebApp("spring-boot-vuejs-azure", {
    location: resourceGroup.location,
    resourceGroupName: resourceGroup.name,
    serverFarmId: appServicePlan.id,
    siteConfig: {
        linuxFxVersion: `DOCKER|${imageName}`,
    },
    httpsOnly: true,
});

Теперь, запуская pulumi up -y, я получаю следующую ошибку:

pulumi up -y
Previewing update (dev)

View Live: https://app.pulumi.com/jonashackt/spring-boot-pulumi-azure/dev/previews/3317933e-0051-4dfc-b436-8fe4184d11f5

     Type                        Name                          Plan
     pulumi:pulumi:Stack         spring-boot-pulumi-azure-dev
 +   └─ azure-native:web:WebApp  spring-boot-vuejs-azure       create

Outputs:
  + helloEndpoint: output<string>

Resources:
    + 1 to create
    3 unchanged

Updating (dev)

View Live: https://app.pulumi.com/jonashackt/spring-boot-pulumi-azure/dev/updates/5

     Type                        Name                          Status                  Info
     pulumi:pulumi:Stack         spring-boot-pulumi-azure-dev  **failed**              1 error
 +   └─ azure-native:web:WebApp  spring-boot-vuejs-azure       **creating failed**     1 error

Diagnostics:
  azure-native:web:WebApp (spring-boot-vuejs-azure):
    error: Code="BadRequest" Message="The parameter LinuxFxVersion has an invalid value." Details=[{"Message":"The parameter LinuxFxVersion has an invalid value."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"01007","Message":"The parameter LinuxFxVersion has an invalid value.","MessageTemplate":"The parameter {0} has an invalid value.","Parameters":["LinuxFxVersion"]}}]

  pulumi:pulumi:Stack (spring-boot-pulumi-azure-dev):
    error: update failed

Resources:
    3 unchanged

Duration: 22s

Вот также полный пример проекта.


person jonashackt    schedule 07.03.2021    source источник


Ответы (1)


Как указано в этом so answer, проблема заключается в конфигурации Azure AppService в azure.web.AppServicePlan. Хотя мы установили kind: "Linux", на самом деле это машина с Windows.

Отсутствует параметр reserved: true, внутри нашего AppService:

const appServicePlan = new azure.web.AppServicePlan("sp-spring-boot", {
    location: resourceGroup.location,
    resourceGroupName: resourceGroup.name,
    kind: "Linux",
    reserved: true,
    sku: {
        name: "B1",
        tier: "Basic",
    },
});

Как указано в документации, не устанавливая для параметра reserved значение true, мы получили машину с Windows. Это даже отображается на портале Azure, если вы используете kind: "Linux" без параметра:

введите здесь описание изображения

person jonashackt    schedule 07.03.2021