DEV Community

Cover image for Reuse tfvars in Powershell
Antoine
Antoine

Posted on

1

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)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay