Add Copy support for resources#1099
Merged
SteveL-MSFT merged 3 commits intoPowerShell:mainfrom Sep 12, 2025
Merged
Conversation
402cb32 to
daccab1
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds copy support for resources to enable looping functionality in DSC configurations. It introduces a new copyIndex() function that can be used within copy loops to generate dynamic resource names and properties based on the current iteration index.
- Introduces copy loop functionality for resources with unrolling during configuration validation
- Adds the
copyIndex()function for accessing loop indices with support for offsets and named loops - Restricts usage of
reference()function within copy loops to prevent invalid state dependencies
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dsc_lib/src/functions/reference.rs | Prevents reference() function usage in copy mode |
| dsc_lib/src/functions/mod.rs | Registers the new copyIndex function |
| dsc_lib/src/functions/copy_index.rs | Implements the copyIndex() function with loop index access |
| dsc_lib/src/configure/mod.rs | Adds copy loop unrolling logic during configuration validation |
| dsc_lib/src/configure/context.rs | Extends context with copy-related state tracking |
| dsc_lib/src/configure/config_doc.rs | Changes copy count and batch size fields from i32 to i64 |
| dsc_lib/locales/en-us.toml | Adds localized error messages for copy functionality |
| dsc/tests/dsc_copy.tests.ps1 | Comprehensive test coverage for copy loop functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
tgauth
reviewed
Sep 11, 2025
tgauth
approved these changes
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Add
copysupport for resources. This PR does not includecopysupport for variables nor properties which will come later. ThemodeandbatchSizeproperties forcopyare not supported.Symbolic names aren't supported, that'll be added as part of ARM Language 2.0 work
PR Context
Fix #496