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

Consider Enabling TF_LOG_PROVIDER to Set Root Provider (and Root SDK?) Logger Levels #72

Open
bflad opened this issue Jul 5, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@bflad
Copy link
Member

bflad commented Jul 5, 2022

terraform-plugin-log version

v0.4.0

Use cases

terraform-plugin-sdk/v2@v2.18.0 enables the acceptance testing framework to passthrough the TF_LOG_CORE and TF_LOG_PROVIDER environment variables to its underlying terraform-exec handling and ultimately Terraform CLI. Acceptance testing is a little strange in terms of logging because the provider "under test" is being executed directly with its logs being controlled by the testing framework, rather than production where logs flow always through Terraform CLI. This means that setting just TF_LOG_PROVIDER during testing does not have the desired effect of controlling the provider under test logs anymore (it does, however, control external providers that still log through Terraform CLI).

Attempted solutions

TF_LOG_CORE=WARN TF_LOG_PROVIDER_XXX=TRACE go test

Proposal

Introduce additional environment variable handling into the root loggers that would allow provider logging to work the same in production and acceptance testing.

The following behaviors could be a good starting point:

TF_LOG_PROVIDER TF_LOG_PROVIDER_XXX TF_LOG_SDK Provider Log Level SDK Log Level
(none) (none) (none) OFF OFF
DEBUG (none) (none) DEBUG DEBUG
(none) DEBUG (none) DEBUG OFF
(none) (none) DEBUG OFF DEBUG
(none) TRACE DEBUG TRACE DEBUG
TRACE DEBUG (none) DEBUG TRACE
TRACE (none) DEBUG TRACE DEBUG
TRACE DEBUG INFO DEBUG INFO

References

@bflad bflad added the enhancement New feature or request label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant