如何通过 cdktf 使用 Azure 容器注册表部署应用服务
How to deploy App Service with Azure Container Registry by cdktf
我正在尝试使用带有 CDKTF 和提供商 AzureRM 2.70.0 的 Azure 容器注册表创建应用服务(也尝试使用最新版本)
当我写这些代码时
this.appService = new AppService(this, "iShare App", {
name: process.env.PROJECT_NAME! + process.env.ENV,
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
appServicePlanId: appServicePlan.id,
dependsOn: [appServicePlan],
appSettings: {
"WEBSITES_PORT" : "5000",
"DOCKER_REGISTRY_SERVER_URL" : props.containerregistry.containerRegistry.loginServer,
"DOCKER_REGISTRY_SERVER_USERNAME" : props.containerregistry.containerRegistry.adminUsername,
"DOCKER_REGISTRY_SERVER_PASSWORD" : props.containerregistry.containerRegistry.adminPassword,
},
kind: "linux",
siteConfig: {
linuxfxversion: "DOCKER|isharedemotest3dev.azurecr.io/isharedemotest3-hades:2fb17de",
always_on: true,
health_check_path: "/health",
}
}
然后弹出这个错误
TS2322: Type '{ linuxfxversion: string; always_on: true; health_check_path: string; }' is not assignable to type 'AppServiceSiteConfig[]'.
Object literal may only specify known properties, and 'linuxfxversion' does not exist in type 'AppServiceSiteConfig[]'.
app-service.d.ts(118, 14): The expected type comes from property 'siteConfig' which is declared here on type 'AppServiceConfig'
在应用程序上-service.d.ts
readonly siteConfig?: AppServiceSiteConfig[];
/**
* source_control block.
*
* Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/azurerm/r/app_service#source_control AppService#source_control}
*
* @stability stable
*/
其中有一个linuxfxversion的选项,但它仍然是一个错误(尝试了任何字母大小写,结果相同)
我该如何解决这个问题?谢谢。
siteConfig 属性缺少一个额外的 []
。
应该是
siteConfig: [{
linuxfxversion: "DOCKER|isharedemotest3dev.azurecr.io/isharedemotest3-hades:2fb17de",
always_on: true,
health_check_path: "/health",
}]
这里的背景是 siteConfig 可以有多个条目(至少根据 Terraform 提供程序模式),因此您需要将其包装在一个数组中。
我正在尝试使用带有 CDKTF 和提供商 AzureRM 2.70.0 的 Azure 容器注册表创建应用服务(也尝试使用最新版本) 当我写这些代码时
this.appService = new AppService(this, "iShare App", {
name: process.env.PROJECT_NAME! + process.env.ENV,
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
appServicePlanId: appServicePlan.id,
dependsOn: [appServicePlan],
appSettings: {
"WEBSITES_PORT" : "5000",
"DOCKER_REGISTRY_SERVER_URL" : props.containerregistry.containerRegistry.loginServer,
"DOCKER_REGISTRY_SERVER_USERNAME" : props.containerregistry.containerRegistry.adminUsername,
"DOCKER_REGISTRY_SERVER_PASSWORD" : props.containerregistry.containerRegistry.adminPassword,
},
kind: "linux",
siteConfig: {
linuxfxversion: "DOCKER|isharedemotest3dev.azurecr.io/isharedemotest3-hades:2fb17de",
always_on: true,
health_check_path: "/health",
}
}
然后弹出这个错误
TS2322: Type '{ linuxfxversion: string; always_on: true; health_check_path: string; }' is not assignable to type 'AppServiceSiteConfig[]'.
Object literal may only specify known properties, and 'linuxfxversion' does not exist in type 'AppServiceSiteConfig[]'.
app-service.d.ts(118, 14): The expected type comes from property 'siteConfig' which is declared here on type 'AppServiceConfig'
在应用程序上-service.d.ts
readonly siteConfig?: AppServiceSiteConfig[];
/**
* source_control block.
*
* Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/azurerm/r/app_service#source_control AppService#source_control}
*
* @stability stable
*/
其中有一个linuxfxversion的选项,但它仍然是一个错误(尝试了任何字母大小写,结果相同)
我该如何解决这个问题?谢谢。
siteConfig 属性缺少一个额外的 []
。
应该是
siteConfig: [{
linuxfxversion: "DOCKER|isharedemotest3dev.azurecr.io/isharedemotest3-hades:2fb17de",
always_on: true,
health_check_path: "/health",
}]
这里的背景是 siteConfig 可以有多个条目(至少根据 Terraform 提供程序模式),因此您需要将其包装在一个数组中。