简体   繁体   English

Arm 模板(二头肌):合并 appsettings 时的循环依赖(列表函数)

[英]Arm Template (Bicep): Circular Dependency when merging appsettings (list function)

I'm trying to update the AppSettings of an App Service through a bicep file.我正在尝试通过二头肌文件更新应用服务的 AppSettings。

When doing this in my bicep template:在我的二头肌模板中执行此操作时:

var currentAppSettings = list('Microsoft.Web/sites/appServiceName/config/appsettings', '2018-11-01')

var newAppSettings = {
  test: 'testValue'
}

var mergedAppSettings = union(currentAppSettings, newAppSettings)

resource appServiceConfig 'Microsoft.Web/sites/config@2018-11-01' = {
  name: 'appServiceName/appSettings'
  properties: mergedAppSettings
}

...I get a circular dependency error when deploying the bicep file: ...部署二头肌文件时出现循环依赖错误:

"Deployment template validation failed: 'Circular dependency detected on resource: '/subscriptions/293d7347-b26f-4413-9986-d61717aaff26/resourceGroups/WSAPlayground/providers/Microsoft.Web/sites/playground-fitxp-backend-euw-wa/config/appSettings'. Please see https://aka.ms/arm-template/#resources for usage details.'."

Is there a way to do this without getting the dependency error?有没有办法做到这一点而不会出现依赖错误?

try using modules.尝试使用模块。 Bicep modules are essentially nested deployments. Bicep 模块本质上是嵌套部署。 in the top level file (ie main) extract the current values and pass them to the submodule (appsettings) as parameter of type object and then execute merge and update.在顶层文件(即 main)中提取当前值并将它们作为 object 类型的参数传递给子模块(appsettings),然后执行合并和更新。 clue is to deploy the update in a different module than reading current value.线索是将更新部署在与读取当前值不同的模块中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM