Photo by Thought Catalog on Unsplash
To reuse data in Powershell set in tfvars, we just have to use the ConvertFrom-StringData cmdlet.
In order to remove some character (such as { or } ), we can use -replace .
That will give us
$file = Get-Content .\varfile.tfvars
$file = $file -replace "}", ""
$file = $file -replace "{", ""
$convert = $file | ConvertFrom-StringData
Hope this help !
Top comments (0)