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

provider: Enable request/response logging #55

Merged
merged 1 commit into from
Feb 13, 2019
Merged

provider: Enable request/response logging #55

merged 1 commit into from
Feb 13, 2019

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Jan 26, 2019

Depends on hashicorp/terraform#20131


This will allow anyone to debug any potential provider issues more easily.

The exact same mechanism is already in use in number of other providers (e.g. GCP, GitHub or Fastly).

Here's an example from log (when compiled with this patch):

2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: ---[ REQUEST ]---------------------------------------
2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: GET / HTTP/1.1
2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: Host: app.terraform.io
2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: User-Agent: go-tfe
2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: Accept-Encoding: gzip
2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: 
2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: 
2019-01-26T18:26:05.345Z [DEBUG] plugin.terraform-provider-tfe: -----------------------------------------------------
2019-01-26T18:26:05.861Z [DEBUG] plugin.terraform-provider-tfe: 2019/01/26 18:26:05 [DEBUG] TFE API Response Details:
2019-01-26T18:26:05.861Z [DEBUG] plugin.terraform-provider-tfe: ---[ RESPONSE ]--------------------------------------
2019-01-26T18:26:05.861Z [DEBUG] plugin.terraform-provider-tfe: HTTP/2.0 301 Moved Permanently
2019-01-26T18:26:05.861Z [DEBUG] plugin.terraform-provider-tfe: Cache-Control: no-cache
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: Content-Type: text/html; charset=utf-8
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: Date: Sat, 26 Jan 2019 18:26:05 GMT
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: Location: https://app.terraform.io/session
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: Vary: Accept-Encoding
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: Vary: Origin
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: X-Content-Type-Options: nosniff
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: X-Frame-Options: SAMEORIGIN
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: X-Ratelimit-Limit: 30
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: X-Ratelimit-Remaining: 28
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: X-Ratelimit-Reset: 0.061
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: X-Request-Id: d24686a8-977e-0c24-29b2-e1b714b0ef88
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: X-Xss-Protection: 1; mode=block
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: 
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: <html><body>You are being <a href="https://app.terraform.io/session">redirected</a>.</body></html>
2019-01-26T18:26:05.862Z [DEBUG] plugin.terraform-provider-tfe: -----------------------------------------------------

Copy link
Contributor

@svanharmelen svanharmelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we first need to update the vendored Terraform (using the v0.11 branch) and go-tfe bits , right? But after that these changes should be good to go 👍

@radeksimko
Copy link
Member Author

I will bump the vendored Terraform version once hashicorp/terraform#20270 is merged.

@radeksimko
Copy link
Member Author

@svanharmelen Rebased & ready to go, are you happy for me to push the button?

Copy link
Contributor

@svanharmelen svanharmelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@radeksimko radeksimko merged commit ab15735 into master Feb 13, 2019
@radeksimko radeksimko deleted the f-logging branch February 13, 2019 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants