Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provider: update internal logging sink to use cloudflare-go logger
As of cloudflare/cloudflare-go#1164 we have the ability to use the inbuilt logger for redacting sensitive HTTP headers. Previously, we were discarding the provided logger due to instantiating a new `cleanhttp` client to use however, with this change we are now using the cloudflare-go logger for HTTP interactions inside the Terraform Core sink. By default we redact the values found in the following HTTP headers (not the headers themselves) in the entire HTTP interaction: - `X-Auth-Email` - `X-Auth-Key` - `X-Auth-User-Service-Key` - `Authorization` And here is an example of the logger in action for `TF_LOG=DEBUG`. ``` 2023-01-05T06:49:41.208221+11:00 [DEBUG] cloudflare GET /client/v4/zones/0da42c8d2132a9ddaf714f9e7c920711/access/apps/dec500cc-4eb3-4c64-b10d-1fce8f686339 HTTP/1.1 Host: api.cloudflare.com User-Agent: terraform/1.3.6 terraform-plugin-sdk/2.10.1 terraform-provider-cloudflare/dev Content-Type: application/json X-Auth-Email: [redacted] X-Auth-Key: [redacted] Accept-Encoding: gzip 2023-01-05T06:49:41.208221+11:00 [DEBUG] cloudflare HTTP/1.1 200 OK Transfer-Encoding: chunked Cf-Cache-Status: DYNAMIC Cf-Ray: 78467fb52e4baaf9-SYD Connection: keep-alive ... { "result": { "id": "dec500cc-4eb3-4c64-b10d-1fce8f686339", "uid": "dec500cc-4eb3-4c64-b10d-1fce8f686339", // .. "http_only_cookie_attribute": false }, "success": true, "errors": [], "messages": [] } ```
- Loading branch information