Skip to content
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

Feature: Enable JSON parsing for getting TF config variables #959

Merged
merged 5 commits into from
Aug 19, 2021
Merged

Feature: Enable JSON parsing for getting TF config variables #959

merged 5 commits into from
Aug 19, 2021

Conversation

relusc
Copy link
Contributor

@relusc relusc commented Jul 25, 2021

Fixes #954

This change enables the parsing of tfvars.json files for getting variables of the submitted TF config files. Uses the JSON parsing functionality provided by the package already used for HCL parsing.

Copy link
Member

@brikis98 brikis98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! I'll kick off tests now.

@relusc
Copy link
Contributor Author

relusc commented Aug 4, 2021

@brikis98 thanks for your review ! it seems like the tests failed, however those seem to be unrelated to my changes. Is there anything i can do or something that needs to be adjusted ?

Copy link
Member

@brikis98 brikis98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one test failure and it seems unrelated; some intermittent thing that we may have already fixed in master. Merging now, thanks!

@brikis98 brikis98 merged commit eca9214 into gruntwork-io:master Aug 19, 2021
@bj-1795
Copy link

bj-1795 commented Sep 7, 2021

@brikis98 Could you please help me understand how can we pass tfvars.json in terraform options??

@relusc
Copy link
Contributor Author

relusc commented Sep 8, 2021

@bj-1795 just use

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
	TerraformDir: "<path-to-terraform-dir>",
	VarFiles:     []string{"test.tfvars.json"},
})

so you basically just use the already known VarFiles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terratest seems to not being able to parse HCL JSON files
3 participants