试图做某事,我不知道这是否可能,如果可能,我正在寻求一些关于如何做的帮助。
我有一个文件";测试二头肌";有一个对象:
{
name: 'testRafaelRule'
priority: 1001
ruleCollectionType: 'FirewallPolicyFilterRuleCollection'
action: {
type: 'Allow'
}
rules: [
{
name: 'deleteme-1'
ipProtocols: [
'Any'
]
destinationPorts: [
'*'
]
sourceAddresses: [
'192.168.0.0/16'
]
sourceIpGroups: []
destinationIpGroups: []
destinationAddresses: [
'AzureCloud.EastUS'
]
ruleType: 'NetworkRule'
destinationFqdns: []
}
]
}
我有另一个文件,在其中我试图以某种方式将test.bicep中的对象输入到一个名为"的特定属性中;ruleCollections":
resource fwll 'Microsoft.Network/firewallPolicies/ruleCollectionGroups@2020-11-01' = {
name: 'netrules'
properties: {
priority: 200
ruleCollections: [
**ADD_OBJECT_FROM_TEST.BICEP_HERE_HOW?**
]
}
}
任何有用文档的建议或链接都会很有帮助。我已经查看了输出和参数,但我试图将一个对象添加到现有属性中,我不是单独添加整个资源,否则,我会输出资源并使用"来消耗它;模块";关键字。
这不可能很简单,但您可以利用变量或模块的输出。
var RULE = {
name: 'testRafaelRule'
priority: 1001
(...)
}
resource fwll 'Microsoft.Network/firewallPolicies/ruleCollectionGroups@2020-11-01' = {
name 'netrules'
properties: {
ruleCollections: [
RULE
]
}
}
或
规则.bicep
output rule object = {
name: 'testRafaelRule'
priority: 1001
(...)
}
main.bicep
module fwrule 'rule.bicep' = {
name: 'fwrule'
}
resource fwll 'Microsoft.Network/firewallPolicies/ruleCollectionGroups@2020-11-01' = {
name 'netrules'
properties: {
ruleCollections: [
fwrule.outputs.rule
]
}
}