Skip to content

Improve New-AzStateDiscovery

Pre-release
Pre-release
Compare
Choose a tag to compare
@krowlandson krowlandson released this 05 Sep 14:15
· 10 commits to main since this release

This release fixes an issue where AzState objects returned from thread jobs in PowerShell return the following error when accessing methods:

OperationStopped: Object reference not set to an instance of an object.

This ensures that the output from New-AzStateDiscovery (and other operations using thread jobs to generate AzState objects) are able to operate as expected for subsequent commands.

As part of this fix, we have also updated the FromScope method to utilise FromIds when processing in [parallel] mode. This helps to keep the code DRY and reduces future test coverage requirements.

Although planned for removal from the class (intent is to move to dedicated set of functions to improve maintainability and reduce the reliance on calss updates), this release also introduces some changes to the built-in Terraform() method to ensure semantically correct code is generated.

The GetAzStateChildren method has been removed, as this is handled by the Get-AzStateChildrenByType function.

Updates have also been made to the IAM and Policy methods, making discovery a manual step. This is to provide a substantial performance boost for scenarios where IAM and Policy discovery is not required. Further updates will be made in this area to improve the process of getting AzState for IAM and Policy objects whilst populating the IAM and Policy attributes in the AzState object for the primary Resource.