Skip to content

Commit

Permalink
fix: boolean true output issue (#215)
Browse files Browse the repository at this point in the history
# Pull Request

## Issue

Issue #212 

## Description

Resolve issue with exporting true boolean valued variables to TF VARS
file.

## License

By submitting this pull request, I confirm that my contribution is made
under the terms of the projects associated license.
  • Loading branch information
jaredfholgate authored Oct 14, 2024
1 parent 31c701e commit ab5cad8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ALZ/Private/Config-Helpers/Write-TfvarsJsonFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ function Write-TfvarsJsonFile {
foreach($configurationProperty in $configuration.PSObject.Properties | Sort-Object Name) {
$configurationValue = $configurationProperty.Value.Value

if($configurationValue -eq "sourced-from-env") {
if($configurationValue.ToString() -eq "sourced-from-env") {
continue
}

if($configurationProperty.Value.Validator -eq "configuration_file_path") {
$configurationValue = [System.IO.Path]::GetFileName($configurationValue)
}

$jsonObject["$($configurationProperty.Name)"] = $configurationValue
Write-Verbose "Writing to tfvars.json - Configuration Property: $($configurationProperty.Name) - Configuration Value: $configurationValue"
$jsonObject.Add("$($configurationProperty.Name)", $configurationValue)
}

$jsonString = ConvertTo-Json $jsonObject -Depth 100
$jsonString | Out-File $tfvarsFilePath
}
}
}
2 changes: 2 additions & 0 deletions src/ALZ/Private/Deploy-Accelerator-Helpers/New-Bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ function New-Bootstrap {
-inputConfig $inputConfig `
-copyEnvVarToConfig

Write-Verbose "Final Starter Parameters: $(ConvertTo-Json $starterParameters -Depth 100)"

# Creating the tfvars files for the bootstrap and starter module
$tfVarsFileName = "terraform.tfvars.json"
$bootstrapTfvarsPath = Join-Path -Path $bootstrapModulePath -ChildPath $tfVarsFileName
Expand Down

0 comments on commit ab5cad8

Please sign in to comment.