-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to read variables file. No .tfvars file copied when using test_structure.CopyTerraformFoldertoTemp #972
Comments
I looked at the syntax for VarFiles here https://github.com/gruntwork-io/terratest/blob/master/modules/terraform/options.go#L12 Am I suppose to use the -var-files flag, if so how? I've searched for examples and since it's a more recent PR, unable to find any examples from searching the web. |
So I found out the following information. https://github.com/gruntwork-io/terratest/blob/master/modules/files/files.go
How do I make an exception for the |
Only thing I can think of is to create a version of the method that accepts a |
@brikis98 ent-lhirschi Did you find the way to declare the tfvars file?? I am getting error like file does not exist. |
Following, I am facing the same problem |
I was able to solve this, just use file name in varfile don't use full path and keep the file in same dir as Terraformdir. |
could you show me an example please?
|
terraformOptions := &terraform.Options{
} defer terraform.Destroy(t, terraformOptions) |
Goal: Have terratest use or detect my terraform.tfvars to pass variables.
Issue: I believe Terratest failed to read the terraform.tfvars because it wasn't copied from my terraform directory to the temporary directory. Or I didn't write the code properly. (The more likely scenario, but would like help) When I go to check the temporary directory (as you'll see in the error below) the terraform.tfvars doesn't exist.
I was able to run terraform plan successfully in the examples/ directory, which isolates the issue to my go code.
My current code:
The text was updated successfully, but these errors were encountered: