-
Notifications
You must be signed in to change notification settings - Fork 52
Add outputs
support in configuration
#1010
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
base: main
Are you sure you want to change the base?
Conversation
Hey @SteveL-MSFT, In an attempt to fix and test this out locally, I stumbled on a few issues. With the change added to the Bicep CLI at: Azure/bicep#17805, the produced JSON looks like: {
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/config/document.json",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.37.52.64608",
"templateHash": "928342520835393415"
}
},
"resources": [
{
"type": "Microsoft.DSC.Debug/Echo",
"apiVersion": "2025-01-01",
"name": "exampleEcho",
"properties": {
"output": "Hello, world!"
}
}
],
"outputs": {
"exampleOutput": {
"type": "string",
"value": "[reference(concat('Microsoft.DSC.Debug/Echo', '/', 'exampleEcho'), '2025-01-01').output]"
}
}
} When I'm running that through your branch, another error pops up: Looking at the docs, I would say that in the output object, it can be a value or a copy, not what the current implementation has. If I'm running it like this: "outputs": {
"exampleOutput": {
"type": "string",
"value_or_copy": {
"value": "[reference(concat('Microsoft.DSC.Debug/Echo', '/', 'exampleEcho'), '2025-01-01').output]"
}
}
} It at least proceeds further, but comes with the following error message: Nevertheless, one more time try with I wanted to share this to see if improvements can be made at the Bicep side or DSC. Hope it helps further in the development. |
@Gijsreyn the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for an outputs
section in DSC configuration files, enabling custom output values to be returned from configuration operations. This functionality is essential for using DSC bicep files as modules.
- Adds
Output
andValueOrCopy
types to the configuration schema - Implements output processing with type validation and conditional evaluation
- Integrates outputs into all configuration operation results (get, set, test, export)
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
lib/dsc-lib/src/configure/config_doc.rs | Defines the Output and ValueOrCopy data structures and adds outputs field to Configuration |
lib/dsc-lib/src/configure/context.rs | Adds outputs map to track processed output values during configuration execution |
lib/dsc-lib/src/configure/config_result.rs | Adds optional outputs field to all configuration result types |
lib/dsc-lib/src/configure/mod.rs | Implements process_output() method and integrates it into all operation methods |
lib/dsc-lib/locales/en-us.toml | Adds localized messages for output processing feedback |
dsc/tests/dsc_output.tests.ps1 | Adds comprehensive test coverage for the outputs feature |
dsc/tests/dsc_osinfo.tests.ps1 | Adds copyright header to existing test file |
dsc/examples/hello_world.dsc.bicep | Documents the blocked bicep output feature with a comment |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
PR Summary
Currently blocked on Azure/bicep#17670 where bicep is crashing when trying to format the resourceId
Add support to use
outputs
section of configuration to have custom output as part of the result. This is needed to use DSC bicep files as modules.PR Context
Part of #976
Fix #898