gpt4 book ai didi

azure - Bicep 模板中的引用对象变量

转载 作者:行者123 更新时间:2023-12-03 05:26:00 28 4
gpt4 key购买 nike

我目前正在尝试手动将现有 ARM 模板转换为二头肌,因为自动反编译方法失败。

现有模板包含以下变量:

"environmentSize": {
"dev": "small",
"msdn": "small",
"int": "small",
"act": "large",
"prod": "large"
},
"size": "[variables('environmentSize')[parameters('environment')]]",

二头肌相当于什么?

我已经尝试了以下方法,但它显然是错误的,因为我在 $ 下面出现了红色波浪线:

var environmentSize = {
dev:'small'
msdn:'small'
int:'small'
act:'large'
prod:'large'
}
var size = environmentSize.${environment}

最佳答案

使用括号表示法应该可以。

param environment string = 'dev'

var environmentSize = {
dev:'small'
msdn:'small'
int:'small'
act:'large'
prod:'large'
}

output size string = environmentSize[environment]

关于azure - Bicep 模板中的引用对象变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68863521/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com