Skip to content

Commit

Permalink
Merge branch 'main' into compliance/add-headers
Browse files Browse the repository at this point in the history
* main:
  updated documentation
  updated CHANGELOG.md
  Add DataDog config to HCP Log Streaming Destination (#803)
  Add in-place update to HCP Log Streaming Destination (#802)
  Update error messages in HCP provider config
  Refactor code to require specific organization configuration
  changelog
  Handle multiple organizations for credentials
  Fixed HttpCodec Check (#781)
  updated documentation
  updated CHANGELOG.md
  • Loading branch information
catsby committed Apr 5, 2024
2 parents 23add8a + e9d8a3a commit fd115c0
Show file tree
Hide file tree
Showing 17 changed files with 530 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .changelog/781.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
Fixed an issue that caused a HTTP audit-log streaming config to fail with allowed values for http_codec are only "JSON" or "NDJSON"
```
3 changes: 3 additions & 0 deletions .changelog/793.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
Handle the case when multiple organizations are associated with the configured credentials. Now, it instead prompts an error, requiring users to specify a particular organization in the HCP provider config block.
```
3 changes: 3 additions & 0 deletions .changelog/802.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
Add in-place update functionality to `hcp_log_streaming_destination` resource.
```
3 changes: 3 additions & 0 deletions .changelog/803.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
Add DataDog config option for hcp_log_streaming_destination resource.
```
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## v0.86.0 (April 04, 2024)

FEATURES:

* Add DataDog config option for hcp_log_streaming_destination resource. [[GH-803](https://github.com/hashicorp/terraform-provider-hcp/pull/803)]
* Add in-place update functionality to `hcp_log_streaming_destination` resource. [[GH-802](https://github.com/hashicorp/terraform-provider-hcp/pull/802)]

BUG FIXES:

* Fixed an issue that caused a HTTP audit-log streaming config to fail with allowed values for http_codec are only "JSON" or "NDJSON" [[GH-781](https://github.com/hashicorp/terraform-provider-hcp/pull/781)]
* Handle the case when multiple organizations are associated with the configured credentials. Now, it instead prompts an error, requiring users to specify a particular organization in the HCP provider config block. [[GH-793](https://github.com/hashicorp/terraform-provider-hcp/pull/793)]
## v0.85.0 (April 03, 2024)

FEATURES:

* New resource: Add `hcp_waypoint_application` resource for managing Waypoint Application.
New data-source: Add `data.hcp_waypoint_application` data-source for Waypoint Application. [[GH-794](https://github.com/hashicorp/terraform-provider-hcp/pull/794)]

IMPROVEMENTS:

* Documentation: Update hcp_iam_policy docs with HCP Vault Secrets Roles App Manager and App Secret Reader [[GH-801](https://github.com/hashicorp/terraform-provider-hcp/pull/801)]
## v0.84.1 (March 22, 2024)

IMPROVEMENTS:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ terraform {
required_providers {
hcp = {
source = "hashicorp/hcp"
version = "~> 0.84.1"
version = "~> 0.86.0"
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions docs/resources/log_streaming_destination.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ resource "hcp_log_streaming_destination" "example_cloudwatch" {
}
```

## Example Usage: DataDog

```terraform
resource "hcp_log_streaming_destination" "example_datadog" {
name = "example_datadog"
datadog = {
endpoint = "https://datadog-api.com"
api_key = "API_KEY_VALUE_HERE"
application_key = "APPLICATION_VALUE_HERE"
}
}
```

## Example Usage: SplunkCloud

```terraform
Expand All @@ -47,6 +60,7 @@ resource "hcp_log_streaming_destination" "example_splunk_cloud" {
### Optional

- `cloudwatch` (Attributes) (see [below for nested schema](#nestedatt--cloudwatch))
- `datadog` (Attributes) (see [below for nested schema](#nestedatt--datadog))
- `splunk_cloud` (Attributes) (see [below for nested schema](#nestedatt--splunk_cloud))

### Read-Only
Expand All @@ -67,6 +81,19 @@ Optional:
- `log_group_name` (String) The log_group_name of the CloudWatch destination.


<a id="nestedatt--datadog"></a>
### Nested Schema for `datadog`

Required:

- `api_key` (String, Sensitive) The value for the DD-API-KEY to send when making requests to DataDog.
- `endpoint` (String) The Datadog endpoint to send logs to.

Optional:

- `application_key` (String, Sensitive) The value for the DD-APPLICATION-KEY to send when making requests to DataDog.


<a id="nestedatt--splunk_cloud"></a>
### Nested Schema for `splunk_cloud`

Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
hcp = {
source = "hashicorp/hcp"
version = "~> 0.84.1"
version = "~> 0.86.0"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "hcp_log_streaming_destination" "example_datadog" {
name = "example_datadog"
datadog = {
endpoint = "https://datadog-api.com"
api_key = "API_KEY_VALUE_HERE"
application_key = "APPLICATION_VALUE_HERE"
}
}
23 changes: 23 additions & 0 deletions internal/clients/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,26 @@ func DeleteLogStreamingDestination(ctx context.Context, client *Client, loc *sha

return nil
}

func UpdateLogStreamingDestination(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, updatePaths []string, destination *models.LogService20210330Destination) error {
updateParams := log_service.NewLogServiceUpdateStreamingDestinationParams()
updateParams.Context = ctx
updateParams.DestinationResourceID = destination.Resource.ID
updateParams.DestinationResourceLocationOrganizationID = loc.OrganizationID
updateParams.DestinationResourceLocationProjectID = loc.ProjectID

updateBody := &models.LogService20210330UpdateStreamingDestinationRequest{
Destination: destination,
Mask: &models.ProtobufFieldMask{
Paths: updatePaths,
},
}

updateParams.Body = updateBody
_, err := client.LogService.LogServiceUpdateStreamingDestination(updateParams, nil)
if err != nil {
return err
}

return nil
}
Loading

0 comments on commit fd115c0

Please sign in to comment.