Skip to content

Commit

Permalink
Add support for http observability on vault_cluster resource (#671)
Browse files Browse the repository at this point in the history
* Added fields and validation for
http observability provider

* Added tests for http observability

* Noted http observability provider
improvement in changelog

* Ran go generate

* renamed missingParamsError
to invalidProviderConfigError

* updated http_bearer_token, http_basic_user, and http_basic_password to specifiy that only basic or bearer authentication
can be provided at any given time

* Specified allowed values for http_codec

* validate that http_codec
should only be "JSON" or "NDJSON" values

* validated httpMethod so ensure
that its value is either POST, PUT, or PATCH

* added strings.toUpper for httpMethod and httpCodec

* updated http_basic_user
and http_basic_password description

* separated http validation into separate function

* added comment to validateHTTPAuth

* changed validateHttpAuth to validateHTTPAuth

* return httpConfigError last in validateHttpAuth

* renamed missingParamError to invalidProviderConfigError
from newrelic branch

* Ran 'go generate'

* removed httpConfigError from
validateHTTPAuth function

* Made sure that httpBasicAuth is
only set when the user provides authentication

* fixed remaining minor changes

* made order of http and newrelic
provider fields consistent across both files

* added changelog file

* Added HTTP back into emptyConfig

* Removed 660 from changelog
  • Loading branch information
jaireddjawed authored Dec 4, 2023
1 parent 35e91c4 commit e2a9e8e
Show file tree
Hide file tree
Showing 6 changed files with 411 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .changelog/671.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
Add custom http endpoints as an observability provider for streaming audit logs and metrics from HCP Vault clusters.
```
20 changes: 20 additions & 0 deletions docs/data-sources/vault_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ Read-Only:
- `elasticsearch_user` (String) ElasticSearch user for streaming audit logs
- `grafana_endpoint` (String) Grafana endpoint for streaming audit logs
- `grafana_user` (String) Grafana user for streaming audit logs
- `http_basic_password` (String) HTTP basic authentication password for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_user is also provided
- `http_basic_user` (String) HTTP basic authentication username for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_password is also provided
- `http_bearer_token` (String) HTTP bearer authentication token for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_user and http_basic_password are not provided
- `http_codec` (String) HTTP codec for streaming audit logs, allowed values are JSON and NDJSON
- `http_compression` (Boolean) HTTP compression flag for streaming audit logs
- `http_headers` (Map of String) HTTP headers for streaming audit logs
- `http_method` (String) HTTP payload method for streaming audit logs, allowed values are PATCH, POST, or PUT
- `http_payload_prefix` (String) HTTP payload prefix for streaming audit logs
- `http_payload_suffix` (String) HTTP payload suffix for streaming audit logs
- `http_uri` (String) HTTP URI for streaming audit logs
- `newrelic_account_id` (String) NewRelic Account ID for streaming audit logs
- `newrelic_license_key` (String) NewRelic license key for streaming audit logs
- `newrelic_region` (String) NewRelic region for streaming audit logs, allowed values are "US" and "EU"
Expand Down Expand Up @@ -113,6 +123,16 @@ Read-Only:
- `elasticsearch_user` (String) ElasticSearch user for streaming metrics
- `grafana_endpoint` (String) Grafana endpoint for streaming metrics
- `grafana_user` (String) Grafana user for streaming metrics
- `http_basic_password` (String) HTTP basic authentication password for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_user is also provided
- `http_basic_user` (String) HTTP basic authentication username for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_password is also provided
- `http_bearer_token` (String) HTTP bearer authentication token for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_user and http_basic_password are not provided
- `http_codec` (String) HTTP codec for streaming metrics, allowed values are JSON and NDJSON
- `http_compression` (Boolean) HTTP compression flag for streaming metrics
- `http_headers` (Map of String) HTTP headers for streaming metrics
- `http_method` (String) HTTP payload method for streaming metrics, allowed values are PATCH, POST, or PUT
- `http_payload_prefix` (String) HTTP payload prefix for streaming metrics
- `http_payload_suffix` (String) HTTP payload suffix for streaming metrics
- `http_uri` (String) HTTP URI for streaming metrics
- `newrelic_account_id` (String) NewRelic Account ID for streaming metrics
- `newrelic_license_key` (String) NewRelic license key for streaming metrics
- `newrelic_region` (String) NewRelic region for streaming metrics, allowed values are "US" and "EU"
Expand Down
20 changes: 20 additions & 0 deletions docs/resources/vault_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ Optional:
- `grafana_endpoint` (String) Grafana endpoint for streaming audit logs
- `grafana_password` (String, Sensitive) Grafana password for streaming audit logs
- `grafana_user` (String) Grafana user for streaming audit logs
- `http_basic_password` (String, Sensitive) HTTP basic authentication password for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_user is also provided
- `http_basic_user` (String) HTTP basic authentication username for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_password is also provided
- `http_bearer_token` (String, Sensitive) HTTP bearer authentication token for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_user and http_basic_password are not provided
- `http_codec` (String) HTTP codec for streaming audit logs, allowed values are JSON and NDJSON
- `http_compression` (Boolean) HTTP compression flag for streaming audit logs
- `http_headers` (Map of String) HTTP headers for streaming audit logs
- `http_method` (String) HTTP payload method for streaming audit logs, , allowed values are PATCH, POST, or PUT
- `http_payload_prefix` (String) HTTP payload prefix for streaming audit logs
- `http_payload_suffix` (String) HTTP payload suffix for streaming audit logs
- `http_uri` (String) HTTP URI for streaming audit logs
- `newrelic_account_id` (String) NewRelic Account ID for streaming audit logs
- `newrelic_license_key` (String, Sensitive) NewRelic license key for streaming audit logs
- `newrelic_region` (String) NewRelic region for streaming audit logs, allowed values are "US" and "EU"
Expand Down Expand Up @@ -136,6 +146,16 @@ Optional:
- `grafana_endpoint` (String) Grafana endpoint for streaming metrics
- `grafana_password` (String, Sensitive) Grafana password for streaming metrics
- `grafana_user` (String) Grafana user for streaming metrics
- `http_basic_password` (String) HTTP basic authentication password for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_user is also specified
- `http_basic_user` (String) HTTP basic authentication username for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_password is also specified
- `http_bearer_token` (String, Sensitive) HTTP bearer authentication token for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_user and http_basic_password are not provided
- `http_codec` (String) HTTP codec for streaming metrics, allowed values are JSON and NDJSON
- `http_compression` (Boolean) HTTP compression flag for streaming metrics
- `http_headers` (Map of String) HTTP headers for streaming metrics
- `http_method` (String) HTTP payload method for streaming metrics, allowed values are PATCH, POST, or PUT
- `http_payload_prefix` (String) HTTP payload prefix for streaming metrics
- `http_payload_suffix` (String) HTTP payload suffix for streaming metrics
- `http_uri` (String) HTTP URI for streaming metrics
- `newrelic_account_id` (String) NewRelic Account ID for streaming metrics
- `newrelic_license_key` (String, Sensitive) NewRelic license key for streaming metrics
- `newrelic_region` (String) NewRelic region for streaming metrics, allowed values are "US" and "EU"
Expand Down
100 changes: 100 additions & 0 deletions internal/providersdkv2/data_source_vault_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,56 @@ If a project is not configured in the HCP Provider config block, the oldest proj
Type: schema.TypeString,
Computed: true,
},
"http_basic_user": {
Description: "HTTP basic authentication username for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_password is also provided",
Type: schema.TypeString,
Computed: true,
},
"http_basic_password": {
Description: "HTTP basic authentication password for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_user is also provided",
Type: schema.TypeString,
Computed: true,
},
"http_bearer_token": {
Description: "HTTP bearer authentication token for streaming metrics, one of the two available authentication methods, can be specified only if http_basic_user and http_basic_password are not provided",
Type: schema.TypeString,
Computed: true,
},
"http_headers": {
Description: "HTTP headers for streaming metrics",
Type: schema.TypeMap,
Computed: true,
},
"http_codec": {
Description: "HTTP codec for streaming metrics, allowed values are JSON and NDJSON",
Type: schema.TypeString,
Computed: true,
},
"http_compression": {
Description: "HTTP compression flag for streaming metrics",
Type: schema.TypeBool,
Computed: true,
},
"http_method": {
Description: "HTTP payload method for streaming metrics, allowed values are PATCH, POST, or PUT",
Type: schema.TypeString,
Computed: true,
},
"http_payload_prefix": {
Description: "HTTP payload prefix for streaming metrics",
Type: schema.TypeString,
Computed: true,
},
"http_payload_suffix": {
Description: "HTTP payload suffix for streaming metrics",
Type: schema.TypeString,
Computed: true,
},
"http_uri": {
Description: "HTTP URI for streaming metrics",
Type: schema.TypeString,
Computed: true,
},
"newrelic_account_id": {
Description: "NewRelic Account ID for streaming metrics",
Type: schema.TypeString,
Expand Down Expand Up @@ -291,6 +341,56 @@ If a project is not configured in the HCP Provider config block, the oldest proj
Type: schema.TypeString,
Computed: true,
},
"http_basic_user": {
Description: "HTTP basic authentication username for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_password is also provided",
Type: schema.TypeString,
Computed: true,
},
"http_basic_password": {
Description: "HTTP basic authentication password for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_user is also provided",
Type: schema.TypeString,
Computed: true,
},
"http_bearer_token": {
Description: "HTTP bearer authentication token for streaming audit logs, one of the two available authentication methods, can be specified only if http_basic_user and http_basic_password are not provided",
Type: schema.TypeString,
Computed: true,
},
"http_headers": {
Description: "HTTP headers for streaming audit logs",
Type: schema.TypeMap,
Computed: true,
},
"http_codec": {
Description: "HTTP codec for streaming audit logs, allowed values are JSON and NDJSON",
Type: schema.TypeString,
Computed: true,
},
"http_compression": {
Description: "HTTP compression flag for streaming audit logs",
Type: schema.TypeBool,
Computed: true,
},
"http_method": {
Description: "HTTP payload method for streaming audit logs, allowed values are PATCH, POST, or PUT",
Type: schema.TypeString,
Computed: true,
},
"http_payload_prefix": {
Description: "HTTP payload prefix for streaming audit logs",
Type: schema.TypeString,
Computed: true,
},
"http_payload_suffix": {
Description: "HTTP payload suffix for streaming audit logs",
Type: schema.TypeString,
Computed: true,
},
"http_uri": {
Description: "HTTP URI for streaming audit logs",
Type: schema.TypeString,
Computed: true,
},
"newrelic_account_id": {
Description: "NewRelic Account ID for streaming audit logs",
Type: schema.TypeString,
Expand Down
Loading

0 comments on commit e2a9e8e

Please sign in to comment.