代码之家  ›  专栏  ›  技术社区  ›  jonashackt

Pulumi azure本机提供程序:azure WebApp:参数LinuxFxVersion的值无效

  •  0
  • jonashackt  · 技术社区  · 4 年前

    我使用Pulumi CLI创建了一个新的Pulumi Typescript程序 pulumi new azure-typescript 并创建了以下内容 index.ts (基于新的 azure-native provider ):

    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
    

    这里还有 the full example project

    1 回复  |  直到 4 年前
        1
  •  3
  •   jonashackt    4 年前

    如本文件所述 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",
        },
    });
    

    As the documentation states 无设置 reserved 参数为true时,我们得到了一台Windows计算机。如果您使用 种类:“Linux” 不带参数:

    enter image description here