Mass populating a new main.tf file from a CSV of resources?

I have thousands of resources in Azure, and it would take a very long time to go through and define a resource block in a main.tf file for each and every resource. I have created a CSV file with a sample set of the same type of resources, and only included columns for each of them that are required for the terraform resource.

What I would like to do is read from this CSV file, and output all of the resources in terraform resource blocks in a new main.tf file.

Is this possible? Are there better ways? I am more versed in PowerShell than Python.

I have successfully created a PowerShell script that can mass import terraform resources from a CSV, but in order to import resources, they need to exist in resource blocks 🙂

  • Please take a look here: stackoverflow.com/help/how-to-ask.

    – 

Leave a Comment