Skip to content

Commit

Permalink
Merge pull request #734 from imjaroiswebdev/secure-logs-level-doc-ref
Browse files Browse the repository at this point in the history
update README to ref SECURE logs level
  • Loading branch information
imjaroiswebdev authored Aug 24, 2023
2 parents 36c11b2 + 8a1d567 commit 6221b86
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The `go-pagerduty` library relies on various APIs to interact with PagerDuty's r
### To activate caching support

| Environment Variable | Example Value | Description |
| -------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|----------------------------|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| TF_PAGERDUTY_CACHE | memory | Activate **In Memory** cache. |
| TF_PAGERDUTY_CACHE | `mongodb+srv://[mongouser]:[mongopass]@[mongodbname].[mongosubdomain].mongodb.net` | Activate MongoDB cache. |
| TF_PAGERDUTY_CACHE_MAX_AGE | 30s | Only applicable for MongoDB cache. Time in seconds for cached data to become staled. Default value `10s`. |
Expand Down Expand Up @@ -144,6 +144,24 @@ $ go mod vendor
$ tail -f /PATH/TO/YOUR/LOG_FILE.log
```

### Secure Logs Level

In addition to the [log levels provided by Terraform](https://developer.hashicorp.com/terraform/internals/debugging), namely `TRACE`, `DEBUG`, `INFO`, `WARN`, and `ERROR` (in descending order of verbosity), the PagerDuty Provider introduces an extra level called `SECURE`. This level offers verbosity similar to Terraform's debug logging level, specifically for the output of API calls and HTTP request/response logs. The key difference is that API keys within the request's Authorization header will be obfuscated, revealing only the last four characters. An example is provided below:

```sh
---[ REQUEST ]---------------------------------------
GET /teams/DER8RFS HTTP/1.1
Accept: application/vnd.pagerduty+json;version=2
Authorization: <OBSCURED>kCjQ
Content-Type: application/json
User-Agent: (darwin arm64) Terraform/1.5.1
```

To enable the `SECURE` log level, you must set two environment variables:

* `TF_LOG=INFO`
* `TF_LOG_PROVIDER_PAGERDUTY=SECURE`

## Testing

In order to test the provider, you can simply run `make test`.
Expand Down

0 comments on commit 6221b86

Please sign in to comment.