Closed davzucky closed 5 years ago
Json vars files are still supported in Terraform 0.12.
From the official documentation of TF located at: https://www.terraform.io/docs/configuration/variables.html Terraform also automatically loads a number of variable definitions files if they are present:
Files named exactly terraform.tfvars or terraform.tfvars.json. Any files with names ending in .auto.tfvars or .auto.tfvars.json. Files whose names end with .json are parsed instead as JSON objects, with the root object properties corresponding to variable names:
{ "image_id": "ami-abc123", "availability_zone_names": ["us-west-1a", "us-west-1c"] }
Personally, I find it significantly easier to work with JSON in python vs. HCL and will continue to work with JSON variable files.
Indeed, my bad... thank you for taking time to reply to me. 1) I was on an old version and the commit 576197d added the file extension. 2) I miised the point about the json in the doc. Sorry. will be more carreful next time
clossing the issue
When are you expecting to push the new version ?
Are you getting issues with TF 0.12, we do have a new version with a couple of fixes there as well as workspace support, but it looks like builds are failing so that will need to be resolved before it gets published. I am not sure that I have the proper access rights in the repo to fix, hoping the owner will come back and allow me to start pushing. He was back the other day and approved PRs including one of mine.
@Spikeophant yes I'm getting the error with TF 0.12. I tried the code which is currently on the main and I can confirm that it works with TF 0.12 and the json format. I keep the code on my local repo until the next release happen. Thank you for implementing the workspace support as well. I found your pull request the same day I want it.
Okay we'll get a version published next week at the latest and then we can retest your issue, if there's still problems on TF 0.12 I will get them fixed.
@Spikeophant Thank you for that. Greatly appreciate.
thank you @Spikeophant for responding, sorry I was pretty occupied recently. I have released 0.10.1 https://github.com/beelit94/python-terraform/releases with the json extension fix.
@beelit94 Thank you for the release. I can confirm that that 0.10.1 is working with terraform 0.12
Terraform 0.12 change the format of the tfvars file form a json to a simple key value list as per documentation https://learn.hashicorp.com/terraform/getting-started/variables.html The current version only generates the json format type which is done by the classVariableFiles initialize as a property self.temp_var_files in Terraform. For the support moving forward, we could allow updating this variable with a v0.12 compatible of test the terraform version and if >= 0.12 change the variable file.
I don't have any preference and I can work on it. Please let me know if you have any preference