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

TF_LOG=trace terraform apply does not print request logs #183

Closed
morganchristiansson opened this issue Oct 31, 2019 · 7 comments · Fixed by #228
Closed

TF_LOG=trace terraform apply does not print request logs #183

morganchristiansson opened this issue Oct 31, 2019 · 7 comments · Fixed by #228
Labels
enhancement New feature or request

Comments

@morganchristiansson
Copy link

When running TF_LOG=trace terraform apply requests logs are not printed.

When doing the same when running acceptance tests they are however.

I had a look in source code and newrelic-go dependency and it seems like it should be output when TF_LOG=trace is set

Terraform Version

Terraform v0.12.12

  • provider.newrelic v1.5.2

Affected Resource(s)

provider.newrelic

Expected Behavior

HTTP request and responses be output to console to view.

Actual Behavior

HTTP requests are not in output. And because requests are using https it's the requests are not easily available for debug.

Steps to Reproduce

  1. Create any newrelic resource
  2. Run TF_LOG=trace terraform apply
@morganchristiansson
Copy link
Author

newrelic.config.Debug is set to logging.IsDebugOrHigher()
https://github.com/terraform-providers/terraform-provider-newrelic/blob/bb6d85381287ce74ba9740a553471bf9f2ec03e3/newrelic/config.go#L21

if config.Debug is true then RestyClient r.setDebug(true)
https://github.com/paultyng/go-newrelic/blob/1a50743299616d5a9ab9f30848121f2df9023e55/api/client.go#L94

So RestyClient r.setDebug(true) is called.

Yet request logs are not appearing

@ctrombley
Copy link
Contributor

@morganchristiansson what you're experiencing is due to the issue described in this thread:
hashicorp/terraform-plugin-sdk#88 (comment)

Terraform core and the providers are separate processes communicating via RPC, and the logs from the SDK are not making their way through to the console when using the terraform command.

I have personally had luck using the Charles web proxy as described in the thread above to inspect at the HTTP layer.

@morganchristiansson
Copy link
Author

Ok makes sense. However the pagerduty provider was printing http requests successfully in the same run.. haven't looked at why.

@ctrombley
Copy link
Contributor

Here's why! Looks like this is achievable after all. I will put a quick PR in.

@ctrombley
Copy link
Contributor

Blocked on merging paultyng/go-newrelic#76.

@ctrombley
Copy link
Contributor

Targeting v1.7.0 for a fix.

@ctrombley ctrombley added enhancement New feature or request and removed question labels Nov 13, 2019
@sanderblue
Copy link
Contributor

Fixed in #228 per paultyng/go-newrelic#76

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

Successfully merging a pull request may close this issue.

3 participants