Member-only story
Converting information from a spreadsheet into Terraform formatted variable files…part 2!
In part one of this post, I discussed how a simple CSV file containing a list of subnets could be read into a PowerShell script and converted into a Terraform configuration file containing those subnets as variables, ready for use in Terraform. This streamlines the workflow and delivery of projects from customer to engineer.
Working with my excellent colleague, Joseph Gadd, he developed a solution in python to take this concept a step further. I do not take any credit for his script as it was all his own work!
The idea of the script is that it can take multiple variable types as input from the spreadsheet, and format them into the correct layout in the terraform configuration file. It can handle simple variable blocks with a description, maps, and lists.
The script is publicly available on my GitHub with Joes' permission, it also includes example input and output files. See the readme file for instructions on how to use it.
https://github.com/jwroper/excel-to-terraform-convertor
The input spreadsheet looks like this:
… and after conversion, a foundation.auto.tfvars file is generated, that looks like this: