来自另一个模块的二头肌直通输出

问题描述 投票:0回答:1

我有两个模块。 Module1 我无法控制它的制作方式或更改方式。 Module2 使用 Module1 并从自身输出一些值并形成 Module1。

我正在尝试找到一种以不可知的方式将值从 Module1 传递到 Module2 的方法。

这就是我的意思:

模块1.二头肌

//I have no control over this module and the changes made here

output One string = 'One'
output Two string = 'Two'

模块2.bicep


module module1 'Module1.bicep' = {
  name: 'Module1'
}

output Three string = 'Three'
output Foour string = 'Four'

//I would like to pass through the outputs of module 1

//This doesnt work!
//output Module1 object =  module1.outputs

//This works. But I would like to not change this if Module 1 changes
output Module1 object = {
  One: module1.outputs.One
  Two: module1.outputs.Two
}

有没有一种方法可以通过 Module2 抽象 Module1 的输出,而不必将所有输出列出并分组到一个对象中?

谢谢。

azure azure-resource-manager azure-bicep
1个回答
0
投票

像这样简单地访问

Module1
文件中
Module2
的各个输出有什么问题吗?

output One string = module1.outputs.One
output Two string = module1.outputs.Two

或者,您可以尝试:

output Module1 array = module1.outputs

(不过没试过!)

© www.soinside.com 2019 - 2024. All rights reserved.