Azure / ResourceModules

This repository includes a CI platform for and collection of mature and curated Bicep modules. The platform supports both ARM and Bicep and can be leveraged using GitHub actions as well as Azure DevOps pipelines.
https://aka.ms/carml
MIT License
726 stars 457 forks source link

Add parent object and child array as outputs to all modules #624

Open MariusStorhaug opened 2 years ago

MariusStorhaug commented 2 years ago

Description

Output values should return info about parents and children, allowing for outputs something like

Suggestion on parent

output parent object = {
    'resourceGroup': resourceGroup()
    'subscription' : subscription()
    //'managementGroup' : managementGroup() // Depending on the scope
    //'tenant' : tenant()
}

Suggestion on children:

@description('A list of all the <childType> objects.')
output <childType> array = <mainResource>::<childResource>
jontreynes commented 2 years ago

I will go through discovery phase of which modules have this case

jontreynes commented 2 years ago

All cases (This will be a running list)

  1. https://github.com/Azure/ResourceModules/blob/main/arm/Microsoft.AnalysisServices/servers/.bicep/nested_rbac.bicep
jontreynes commented 2 years ago

Notes from today add outputs in reference output example1 { }

server_rbac.output.example1

publicIPAddress: {

        id: !(empty(publicIPAddressId)) ? publicIPAddressId : publicIPAddress.outputs.publicIPAddressResourceId

      }
jontreynes commented 2 years ago

found all references to cases of lists generated by for loop by vscode regex searching with

"resource.*[for"

this gets the inventory of all cases that have dynamic array generated. Need to get inventory of hardcoded array as well

jontreynes commented 2 years ago

schedule a meeting with @MariusStorhaug for next week to review a sample of code to get feedback about using it across all bicep files

AlexanderSehr commented 2 years ago

As resources cannot be returned, I don't think this can be technically implemented right now. If I recall correctly, there exists an issue for that in the Bicep repo

AlexanderSehr commented 2 years ago

The capability to pass/return resources is on the roadmap to be implented in a future bicep version (scheduled to hit before Bicep Version 1.0 in summer). This must be supported before we can implement the feature.

AlexanderSehr commented 1 year ago

Unassigning as it has been a while and I don't expect @jontreynes to work on it any time soon. The required capability in Bicep is still not available.