Azure / ALZ-PowerShell-Module

The Azure Landing Zones Accelerators PowerShell module
https://www.powershellgallery.com/packages/ALZ/
MIT License
79 stars 39 forks source link

fix: Bug-132 #137

Closed oZakari closed 3 months ago

oZakari commented 3 months ago

Pull Request

Issue

Fixes #132

Description

This pull request includes significant enhancements to the Write-TfvarsFile function in the Config-Helpers module. The changes improve the handling of different data types when writing configuration values, ensuring that default values are used when necessary and that the correct format is applied for lists, maps, and objects.

Enhancements to Write-TfvarsFile function:

Tests

Test 1: With this inputs.yaml: image and this variables.tf: image

Will result in this .tfvars: image

Test 2: With the same variables.tf file from example 1 and inputs.yaml file missing declarations for the complex types: image

Note: Although the logic to use the default values exists, there is currently an issue $configuration.PSObject.Properties where the defaultvalue is always empty even when a default value exists. Currently something I am looking into further.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.

matt-FFFFFF commented 3 months ago

@oZakari

Thanks so much for this! Excellent work