This repository has been archived by the owner on Apr 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
paddycarver
suggested changes
Sep 8, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Called out some errors that need checked (sorry for the repetition).
We could also automate this with https://github.com/kisielk/errcheck or golangci-lint.
After some discussion, I'm removing the propagation of the whole |
paddycarver
approved these changes
Sep 9, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Requires hashicorp/terraform-exec#78
This PR fixes issues introduced in #35, in which Terraform commands were reimplemented using terraform-exec. The tfexec paradigm does not permit transparent propagation of environment variables through to the Terraform CLI process, which meant that the crucial
TF_PROVIDERS_REATTACH
env var was not present in the binary testing environment. This behaviour, and the ability for the caller to set other env vars at arbitrary times, is restored by allowingWorkingDir
to maintain a pseudo-environment.Add
wd.SetReattachInfo(reattachInfo string)
andwd.UnsetReattachInfo()
The caller provides the reattach info (the contents of
TF_PROVIDERS_REATTACH
), and this is stored onWorkingDir
and added to each tfexec command as necessary.Restore previous behaviour of(reverted, see comment below)wd.Setenv(envVar, val string)
Since terraform-plugin-test is no longer in control of the environment variables for each Terraform command, we instead ensure the correct environment is set before eachtfexec.Terraform
command.Note:wd.Setenv
andwd.Unsetenv
are not used in the SDK, and should be removed if there is no clear use case. This is a breaking change and so will be dealt with separately as https://github.com/hashicorp/terraform-plugin-test/issues/39.