Skip to content

Commit 38b8e83

Browse files
committed
linter
1 parent 932119e commit 38b8e83

File tree

3 files changed

+286
-7
lines changed

3 files changed

+286
-7
lines changed
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
---
2+
subcategory: "Pipeline"
3+
description: |-
4+
A Configuration is a combination of sources, processors, and destinations
5+
used by BindPlane OP to generate an agent configuration.
6+
7+
Configuration V2 is the latest iteration of the BindPlane Configuration resource.
8+
It supports advanced routing and OpenTelemetry Connectors.
9+
---
10+
11+
# bindplane_configuration_v2
12+
13+
The `bindplane_configuration_v2` resource creates a BindPlane configuration that can be applied
14+
to one or more managed agents. Configurations are a combination of [sources](./bindplane_source.md),
15+
[destinations](./bindplane_destination.md), [processors](./bindplane_processor.md), and [connectors](./bindplane_connector.md).
16+
Explicit routes can be defined between components to control how telemetry data flows through the configuration.
17+
18+
Configuration V2 builds upon [Configuration V1](./bindplane_configuration.md) by introducing the following features:
19+
- **Routing**: Routes can be defined between all components. This allows for
20+
more granular control over how telemetry data flows through the configuration.
21+
- **Connectors**: [OpenTelemetry Connectors](https://github.com/open-telemetry/opentelemetry-collector/blob/main/connector/README.md)
22+
can be defined in the configuration. Connectors are used to route telemetry between pipelines, such as counting the number of logs
23+
and emitting a metric based on that count.
24+
- **Processors**: Processors can be defined in the configuration without attaching them directly to sources or destinations.
25+
This allows for more flexibility in how processors are used within a configuration. Processors can still be attached to sources
26+
or destinations just like before.
27+
28+
## Options
29+
30+
| Option | Type | Default | Description |
31+
| ------------------ | --------------- | -------- | --------------------------------------------------------------------------- |
32+
| `name` | string | required | The source name. |
33+
| `platform` | string | required | The platform the configuration supports. See the [supported platforms](./bindplane_configuration.md#supported-platforms) section. |
34+
| `labels` | map | optional | Key value pairs representing labels to set on the configuration. |
35+
| `source` | block | optional | One or more source blocks. See the [source block](./bindplane_configuration.md#source-block) section. |
36+
| `destination` | block | optional | One or more destination blocks. See the [destination block](./bindplane_configuration.md#destination-block) section. |
37+
| `extensions` | list(string) | optional | One or more extension names to attach to the configuration. |
38+
| `rollout` | bool | required | Whether or not updates to the configuration should trigger an automatic rollout of the configuration. |
39+
| `rollout_options` | block (single) | optional | Options for configuring the rollout behavior of the configuration. See the [rollout options block](./bindplane_configuration.md#rollout-options-block) section. |
40+
41+
### Source Block
42+
43+
| Option | Type | Default | Description |
44+
| ------------------- | ------------ | -------- | ---------------------------- |
45+
| `name` | string | required | The source name. |
46+
| `processors` | list(string) | optional | One or more processor names to attach to the source. |
47+
| `route` | string | optional | One or more routes to attach to the source. See the [route block](./bindplane_configuration.md#route-block) section. |
48+
49+
### Destination Block
50+
51+
| Option | Type | Default | Description |
52+
| ------------------- | ------------ | -------- | ---------------------------- |
53+
| `name` | string | required | The source name. |
54+
| `processors` | list(string) | optional | One or more processor names to attach to the destination. |
55+
56+
### Rollout Options Block
57+
58+
| Option | Type | Default | Description |
59+
| ------------------- | ------------ | -------- | ---------------------------- |
60+
| `type` | string | required | The type of rollout to perform. Valid values are 'standard' and 'progressive'. |
61+
| `parameters` | list(block) | optional | One or more parameters for the rollout. See the [parameters block](./bindplane_configuration.md#parameters-block) section. |
62+
63+
### Parameters Block
64+
65+
| Option | Type | Default | Description |
66+
| ------------------- | ------------ | -------- | ---------------------------- |
67+
| `name` | string | required | The name of the parameter. |
68+
| `value` | any | required | The value of the parameter. |
69+
70+
### Route Block
71+
72+
| Option | Type | Default | Description |
73+
| ------------------- | ------------ | -------- | ---------------------------- |
74+
| `telemetry_type` | enum | `logs+metrics+traces` | The telemetry type to route. |
75+
| `components` | list(string) | required | One or more components to route the telemetry to. |
76+
77+
Telemetry types include the following
78+
- `logs`
79+
- `metrics`
80+
- `traces`
81+
- `logs+metrics`
82+
- `logs+traces`
83+
- `metrics+traces`
84+
- `logs+metrics+traces` (default)
85+
86+
The following example shows two route blocks, one for all telemetry types and one for traces only.
87+
88+
```tf
89+
# Route all telemetry types to the Datadog destination
90+
route {
91+
components = [
92+
"destinations/${bindplane_destination.datadog.id}"
93+
]
94+
}
95+
96+
# Route only traces to the Google destination
97+
route {
98+
telemetry_type = "traces"
99+
components = [
100+
"destinations/${bindplane_destination.google.id}"
101+
]
102+
}
103+
```
104+
105+
### Supported Platforms
106+
107+
This table should be used as a reference for supported `platform` values.
108+
109+
| Platform | Value |
110+
| ---------------------- | ----------------------- |
111+
| Linux | `linux` |
112+
| Windows | `windows` |
113+
| macOS | `macos` |
114+
| Kubernetes DaemonSet | `kubernetes-daemonset` |
115+
| Kubernetes Deployment | `kubernetes-deployment` |
116+
| OpenShift DaemonSet | `openshift-daemonset` |
117+
| OpenShift Deployment | `openshift-deployment` |
118+
119+
## Examples
120+
121+
This example shows the creation of a `bindplane_configuration_v2` which uses the following resources:
122+
- two [bindplane_source](./bindplane_source.md) resources
123+
- one [bindplane_destination](./bindplane_destination.md) resource
124+
- two [bindplane_processor](./bindplane_processor.md) resources
125+
126+
Routes are configured on the sources to send telemetry data to the destination.
127+
128+
```hcl
129+
resource "bindplane_source" "host" {
130+
rollout = true
131+
name = "my-host"
132+
type = "host"
133+
parameters_json = jsonencode(
134+
[
135+
{
136+
"name": "collection_interval",
137+
"value": 30
138+
},
139+
{
140+
"name": "enable_process",
141+
"value": false
142+
}
143+
]
144+
)
145+
}
146+
147+
resource "bindplane_source" "journald" {
148+
rollout = true
149+
name = "my-journald"
150+
type = "journald"
151+
}
152+
153+
resource "bindplane_destination" "google" {
154+
rollout = true
155+
name = "my-google"
156+
type = "googlecloud"
157+
}
158+
159+
resource "bindplane_processor" "batch" {
160+
rollout = true
161+
name = "my-batch"
162+
type = "batch"
163+
}
164+
165+
resource "bindplane_extension" "pprof" {
166+
rollout = true
167+
name = "my-pprof"
168+
type = "pprof"
169+
parameters_json = jsonencode(
170+
[
171+
{
172+
"name": "listen_address",
173+
"value": "0.0.0.0"
174+
},
175+
{
176+
"name": "tcp_port",
177+
"value": 5000,
178+
}
179+
]
180+
)
181+
}
182+
183+
resource "bindplane_configuration_v2" "configuration" {
184+
// When removing a component from a configuration and deleting that
185+
// component during the same apply, we want to update the configuration
186+
// before the component is deleted.
187+
lifecycle {
188+
create_before_destroy = true
189+
}
190+
191+
rollout = true
192+
name = "my-config"
193+
platform = "linux"
194+
labels = {
195+
environment = "production"
196+
managed-by = "terraform"
197+
}
198+
199+
source {
200+
name = bindplane_source.host.name
201+
route {
202+
components = [
203+
"destinations/${bindplane_destination.google.id}"
204+
]
205+
}
206+
}
207+
208+
source {
209+
name = bindplane_source.journald.name
210+
route {
211+
components = [
212+
"destinations/${bindplane_destination.google.id}"
213+
]
214+
}
215+
}
216+
217+
destination {
218+
name = bindplane_destination.google.name
219+
processors = [
220+
bindplane_processor.batch.name
221+
]
222+
}
223+
224+
extensions = [
225+
bindplane_extension.pprof.name
226+
]
227+
228+
rollout_options {
229+
type = "progressive"
230+
parameters = [
231+
{
232+
name = "stages"
233+
value = [
234+
{
235+
labels = {
236+
env = "stage"
237+
}
238+
name = "stage"
239+
},
240+
{
241+
labels = {
242+
env = "production"
243+
}
244+
name = "production"
245+
}
246+
]
247+
}
248+
]
249+
}
250+
}
251+
```

internal/component/route.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright observIQ, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
package component
216

317
import (
@@ -8,25 +22,25 @@ import (
822
)
923

1024
const (
11-
// Logs route type
25+
// RouteTypeLogs routes logs
1226
RouteTypeLogs = "logs"
1327

14-
// Metrics route type
28+
// RouteTypeMetrics routes metrics
1529
RouteTypeMetrics = "metrics"
1630

17-
// Traces route type
31+
// RouteTypeTraces routes traces
1832
RouteTypeTraces = "traces"
1933

20-
// Logs + Metrics route type
34+
// RouteTypeLogsMetrics routes logs and metrics
2135
RouteTypeLogsMetrics = "logs+metrics"
2236

23-
// Logs + Traces route type
37+
// RouteTypeLogsTraces routes logs and traces
2438
RouteTypeLogsTraces = "logs+traces"
2539

26-
// Metrics + Traces route type
40+
// RouteTypeMetricsTraces routes metrics and traces
2741
RouteTypeMetricsTraces = "metrics+traces"
2842

29-
// Logs + Metrics + Traces route type
43+
// RouteTypeLogsMetricsTraces routes logs, metrics, and traces
3044
RouteTypeLogsMetricsTraces = "logs+metrics+traces"
3145
)
3246

internal/component/route_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright observIQ, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
package component
216

317
import (

0 commit comments

Comments
 (0)