This repository has been archived by the owner on Apr 27, 2021. It is now read-only.
Add SetInputVars and RequireSetInputVars to WorkingDir #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
👋
Description
This PR adds the ability to set input variables by creating a
terraform.tfvars
inputs.auto.tfvars.json
file in the working directory.Context
I'm working on the new Kubernetes provider, which is a crazy wild west provider that doesn't use the existing terraform plugin SDK so we are using this helper package directly in the acceptance tests.
One of things we'd like to do is have the terraform configurations for the acceptance tests be in their own files so that we can easily run them by hand, without having to hack out Go formatting directives. The way we're doing this is by using terraform's own input variables syntax in the test configurations, and supplying them when we set up the test. This way all we need to do is supply variables if we run them by hand. It also makes the test configurations more legible for people looking for runnable examples.
At the moment I have a hack in the test code that creates
variable
blocks with defaults at the top of whatever is created withRequireSetConfig
but it would be nice if the helper could do this for us.Discussion
Not sure if this is even the right abstraction - we could also do this as an additional parameter to SetConfig, or by exposing a way to supply
-var
flags to the baseArgs array instead.