jon*_*ckt 0 azure azure-resource-manager azure-app-service-plans azure-web-app-service pulumi
我使用 Pulumi CLI 创建了一个新的 Pulumi Typescript 程序,pulumi new azure-typescript并创建了以下内容index.ts(基于新的azure-native 提供程序):
import * as pulumi from "@pulumi/pulumi";\nimport * as azure from "@pulumi/azure-native";\n\nconst resourceGroup = new azure.resources.ResourceGroup("rg-spring-boot", {location: "West Europe"});\n\nconst appServicePlan = new azure.web.AppServicePlan("sp-spring-boot", {\n location: resourceGroup.location,\n resourceGroupName: resourceGroup.name,\n kind: "Linux",\n sku: {\n name: "B1",\n tier: "Basic",\n },\n});\n\n// Image https://hub.docker.com/r/jonashackt/spring-boot-vuejs\nconst imageName = "jonashackt/spring-boot-vuejs:latest";\n\nconst appServiceSpringBoot = new azure.web.WebApp("spring-boot-vuejs-azure", {\n location: resourceGroup.location,\n resourceGroupName: resourceGroup.name,\n serverFarmId: appServicePlan.id,\n siteConfig: {\n linuxFxVersion: `DOCKER|${imageName}`,\n },\n httpsOnly: true,\n});\nRun Code Online (Sandbox Code Playgroud)\n现在运行 apulumi up -y我收到以下错误:
pulumi up -y\nPreviewing update (dev)\n\nView Live: https://app.pulumi.com/jonashackt/spring-boot-pulumi-azure/dev/previews/3317933e-0051-4dfc-b436-8fe4184d11f5\n\n Type Name Plan\n pulumi:pulumi:Stack spring-boot-pulumi-azure-dev\n + \xe2\x94\x94\xe2\x94\x80 azure-native:web:WebApp spring-boot-vuejs-azure create\n\nOutputs:\n + helloEndpoint: output<string>\n\nResources:\n + 1 to create\n 3 unchanged\n\nUpdating (dev)\n\nView Live: https://app.pulumi.com/jonashackt/spring-boot-pulumi-azure/dev/updates/5\n\n Type Name Status Info\n pulumi:pulumi:Stack spring-boot-pulumi-azure-dev **failed** 1 error\n + \xe2\x94\x94\xe2\x94\x80 azure-native:web:WebApp spring-boot-vuejs-azure **creating failed** 1 error\n\nDiagnostics:\n azure-native:web:WebApp (spring-boot-vuejs-azure):\n 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"]}}]\n\n pulumi:pulumi:Stack (spring-boot-pulumi-azure-dev):\n error: update failed\n\nResources:\n 3 unchanged\n\nDuration: 22s\nRun Code Online (Sandbox Code Playgroud)\n这也是完整的示例项目。
\n如本文所述,答案问题在于 中的 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",
},
});
Run Code Online (Sandbox Code Playgroud)
正如文档所述,在未将参数设置reserved为 true 的情况下,我们得到了一台 Windows 机器。kind: "Linux"如果您不带参数使用,这甚至会显示在 Azure 门户中:
| 归档时间: |
|
| 查看次数: |
2763 次 |
| 最近记录: |