Upgrade to latest terraform-plugin-go, add logging sink. #805
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.
Upgrade to the latest version of terraform-plugin-go, bringing support
for terraform-plugin-log.
Use the terraform-plugin-log logging sink when setting up the
helper/resource test framework. The idea here is that we'll use the
logging sink to reroute all terraform-plugin-log logs, and leave the
log.Print
logs the way they are with the existing override. Over time,it may be nice to migrate those logs to use terraform-plugin-log, which
we've introduced
logging.GetTestLogContext
as a helper for. But thatmay be a mistake, and maybe we should wait until we need it to introduce
that function.
In theory, this PR should result in no logs being written to the CLI
during testing, which was happening in hashicorp/terraform-plugin-go#93.
It should respect
TF_LOG
andTF_LOG_PATH
, as well as anyterraform-plugin-log style environment variables in use.
I think, by nature of this problem, we're going to need to test it manually for the moment, but I'll leave a comment with information on how to do that.
We should also wait to land this until hashicorp/terraform-plugin-log#15 lands and a release is cut, and hashicorp/terraform-plugin-go#93 lands and a release is cut, which will let us use tagged releases in our go.mod.