Skip to content

Commit 50a6f75

Browse files
committed
Make headers required for telemetry drains and add space-scoped drain test
- API testing revealed headers are required for all telemetry drains - Updated schema to make headers required instead of optional - Added space-scoped telemetry drain back to acceptance test with headers - Updated documentation to reflect headers requirement - Both app-scoped and space-scoped drains now work correctly
1 parent c76b4d5 commit 50a6f75

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

docs/resources/telemetry_drain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The following arguments are supported:
100100
* `"traces"` - Distributed tracing data
101101
* `"metrics"` - Application and system metrics
102102
* `"logs"` - Application and system logs
103-
* `headers` - (Optional) A map of headers to send to your OpenTelemetry consumer for authentication or configuration.
103+
* `headers` - (Required) A map of headers to send to your OpenTelemetry consumer for authentication or configuration. At least one header must be specified.
104104

105105
## Attributes Reference
106106

heroku/resource_heroku_telemetry_drain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func resourceHerokuTelemetryDrain() *schema.Resource {
6060

6161
"headers": {
6262
Type: schema.TypeMap,
63-
Optional: true,
63+
Required: true,
6464
Description: "Headers to send to your OpenTelemetry consumer",
6565
Elem: &schema.Schema{
6666
Type: schema.TypeString,

heroku/resource_heroku_telemetry_drain_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ resource "heroku_telemetry_drain" "app_test" {
104104
headers = {
105105
"x-honeycomb-team" = "test-key"
106106
}
107+
}
108+
109+
resource "heroku_telemetry_drain" "space_test" {
110+
owner_id = heroku_space.foobar.id
111+
owner_type = "space"
112+
endpoint = "https://logs.datadog.com/api/v2/logs"
113+
exporter_type = "otlphttp"
114+
signals = ["logs"]
115+
116+
headers = {
117+
"DD-API-KEY" = "test-space-key"
118+
}
107119
}`,
108120
spaceConfig, appName, testAccConfig.GetOrganizationOrSkip(t))
109121

@@ -119,6 +131,16 @@ resource "heroku_telemetry_drain" "app_test" {
119131
resource.TestCheckResourceAttrSet("heroku_telemetry_drain.app_test", "id"),
120132
resource.TestCheckResourceAttrSet("heroku_telemetry_drain.app_test", "created_at"),
121133
resource.TestCheckResourceAttrSet("heroku_telemetry_drain.app_test", "updated_at"),
134+
135+
// Check space-scoped telemetry drain
136+
resource.TestCheckResourceAttr("heroku_telemetry_drain.space_test", "owner_type", "space"),
137+
resource.TestCheckResourceAttr("heroku_telemetry_drain.space_test", "endpoint", "https://logs.datadog.com/api/v2/logs"),
138+
resource.TestCheckResourceAttr("heroku_telemetry_drain.space_test", "exporter_type", "otlphttp"),
139+
resource.TestCheckResourceAttr("heroku_telemetry_drain.space_test", "signals.#", "1"),
140+
resource.TestCheckResourceAttr("heroku_telemetry_drain.space_test", "headers.DD-API-KEY", "test-space-key"),
141+
resource.TestCheckResourceAttrSet("heroku_telemetry_drain.space_test", "id"),
142+
resource.TestCheckResourceAttrSet("heroku_telemetry_drain.space_test", "created_at"),
143+
resource.TestCheckResourceAttrSet("heroku_telemetry_drain.app_test", "updated_at"),
122144
),
123145
}
124146
}

0 commit comments

Comments
 (0)