DEV Community 👩‍💻👨‍💻

Cover image for Reuse tfvars in Powershell
Antoine
Antoine

Posted on

Reuse tfvars in Powershell

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
Enter fullscreen mode Exit fullscreen mode

Hope this help !

Top comments (0)

DEV has this feature:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠