New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IncludeGroup
to include an external configuration
#412
Comments
One use case for this is configuring development environments like dev box where there are a common set of configurations used across multiple workloads a team or an individual developer has defined. Dev Teams often standardize some environment specific configurations like enabling dev mode, showing hidden files, enabling hyper-v, or installing VS Code across multiple project types. common-dev-env.yaml
- resource: Microsoft.Windows.Developer/DeveloperMode
- resource: Microsoft.Windows.Developer/WindowsExplorer
directives:
allowPrerelease: true
settings:
FileExtensions: Show
HiddenFiles: Show
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: vscode
directives:
allowPrerelease: true
settings:
id: Microsoft.VisualStudioCode intelligent-app.yaml
resources:
- name: commondevenv
type: Microsoft.DSC/Include
properties:
configurationFile: ./common-dev-env.yaml
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: python311
directives:
allowPrerelease: true
settings:
id: Python.Python.3.11
- resource: PSDscResources/Script
id: VSCodemspython
dependsOn:
- python311
- vscode
settings:
SetScript: |
code --install-extension ms-python.python
GetScript: |
return $false
TestScript: |
return $false dotnet-app.yaml
resources:
- name: commondevenv
type: Microsoft.DSC/Include
properties:
configurationFile: ./common-dev-env.yaml
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: dotnet8
directives:
allowPrerelease: true
settings:
id: Microsoft.DotNet.SDK.8
- resource: PSDscResources/Script
id: VSCodemspython
dependsOn:
- dotnet8
- vscode
settings:
SetScript: |
code --install-extension ms-dotnettools.csdevkit
GetScript: |
return $false
TestScript: |
return $false |
I think this is a highly functional group to add to DSC, but I would also like the ability to return the expanded node graph / configuration document, in addition to invoking a DSC operation against it. Consider the following minimal example configuration documents: ---
# configs/baseline/security.dsc.config.yaml
resources:
- type: Test/Echo
name: Security Setting
properties: { output: 'Sets a security value' }
---
# configs/environment/test.dsc.config.yaml
resources:
- type: Microsoft.DSC/Include
name: Security baseline
properties:
configurationFile: >-
[concat(
envvar('DSC_CONFIG_ROOT'),
'/../baseline/security.dsc.config.yaml'
)]
- type: Test/Echo
name: Environmental config
properties: { output: Sets a value for test machines }
dependsOn:
- "[resourceId('Microsoft.DSC/Include', 'Security baseline')]"
---
# configs/webserver.dsc.config.yaml
resources:
- type: Microsoft.DSC/Include
name: Test environment
properties:
configurationFile: >-
[concat(
envvar('DSC_CONFIG_ROOT'),
'/environment/test.dsc.config.yaml'
)]
- type: Test/Echo
name: Webserver config
properties: { output: Sets a value for web servers }
dependsOn:
- "[resourceId('Microsoft.DSC/Include', 'Test environment')]" I would want to both be able to invoke DSC operations against the resources in all three configurations, but I'd also want to be able to see what the expanded document looks like. Maybe I could run a command like this: dsc config resolve --path ./configs/webserver.dsc.config.yaml To get a response like this1: resources:
- type: Microsoft.DSC/Group
name: Test environment
properties:
resources:
- type: Microsoft.DSC/Group
name: Security baseline
properties:
resources:
- type: Test/Echo
name: Security Setting
properties:
output: 'Sets a security value'
- type: Test/Echo
name: Environmental config
properties:
output: Sets a value for test machines
dependsOn:
- "[resourceId('Microsoft.DSC/Group', 'Security baseline')]"
- type: Test/Echo
name: Webserver config
properties:
output: Sets a value for web servers I could save that output, similar to the For other operations, even without An alternate and possibly better UX/DevX, would be to extend the resources:
- name: networking
type: Microsoft.DSC/Group
properties:
configurationFile: ./networking.yaml
- name: storage
type: Microsoft.DSC/Group
properties:
configurationFile: ./storage.yaml So for a Footnotes
|
I think I don't think there's any real benefit of having this capability encapsulated within Finally, |
Created separate issue for |
|
Summary of the new feature / enhancement
Not sure yet if this is a good idea as I can see the main downside that you don't get a complete view of the configuration in one doc, but there might be use cases where you define separate config docs for network, storage, compute (as examples) and you want a higher level doc that applies all of them. So it could look like:
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: