PowerShell / DSC

This repo is for the DSC v3 project
MIT License
133 stars 22 forks source link

Passing params/references to groups/adapters #381

Open SteveL-MSFT opened 3 months ago

SteveL-MSFT commented 3 months ago

Summary of the new feature / enhancement

dsc only has visibility in the top most layer. This means that functions that get called such as parameter() and reference() can only access those within the same layer. A group can access those functions, but only within that group's layer.

Currently, there isn't a way to pass parameters to groups and a group cannot access a reference outside of its layer.

Proposed technical implementation details (optional)

I think we are ok to say that reference only works within a group, but I can see utility in passing parameters lower. In the case of groups, we could define a new to pass parameter values with the expectation that the either the group has a literal parameters section it resolves or we can have it inherit the parent's parameter definitions.

For adapters, we may just not have support for either.

SteveL-MSFT commented 3 months ago

With this PR https://github.com/PowerShell/DSC/pull/385, we can define a new Arg type to indicate passing parameters and another for parameter values which the group resource or adapter can use. In the case of the PS-Adapter, it could then define a global $DSCParameter hashtable that could be used with PS resource properties that get resolved before passing to the PS resource.

michaeltlombardi commented 2 months ago

I think for long-term functionality, we may need to think about a way to reference nested instances. Consider the following cases:

SteveL-MSFT commented 2 months ago

Part of the challenge would be bi-directional support so that raw result content can be sent up to a parent so that a sibling can access it.