skip to Main Content

I have two modules. Module1 I have no control over how it is made or changes to it. Module2 uses Module1 and outputs some values from itself and form Module1.

I am trying to find a way to passthrough the values from Module1 through Module2 in an agnostic fashion.

This is what I mean:

Module1.bicep

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

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

Module2.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
}

Is there a way to abstract the output of Module1 though Module2 without having to list and group all outputs into an object?

Thanks.

2

Answers


  1. What’s wrong with simply accessing the individual outputs from Module1 in your Module2 file like so?

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

    Alternatively, you could try:

    output Module1 array = module1.outputs

    (Not tried that, though!)

    Login or Signup to reply.
  2. I am using this successfully:

    @description('Outputs from Module1')
    output Module1 object = module1.outputs
    

    You may just need to drill down to .value when accessing the values, e.g. Module2.outputs.Module1.One.value.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search