Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirianni committed Feb 8, 2025
1 parent 932119e commit 38b8e83
Show file tree
Hide file tree
Showing 3 changed files with 286 additions and 7 deletions.
251 changes: 251 additions & 0 deletions docs/resources/bindplane_configuration_v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
---
subcategory: "Pipeline"
description: |-
A Configuration is a combination of sources, processors, and destinations
used by BindPlane OP to generate an agent configuration.
Configuration V2 is the latest iteration of the BindPlane Configuration resource.
It supports advanced routing and OpenTelemetry Connectors.
---

# bindplane_configuration_v2

The `bindplane_configuration_v2` resource creates a BindPlane configuration that can be applied
to one or more managed agents. Configurations are a combination of [sources](./bindplane_source.md),
[destinations](./bindplane_destination.md), [processors](./bindplane_processor.md), and [connectors](./bindplane_connector.md).
Explicit routes can be defined between components to control how telemetry data flows through the configuration.

Configuration V2 builds upon [Configuration V1](./bindplane_configuration.md) by introducing the following features:
- **Routing**: Routes can be defined between all components. This allows for
more granular control over how telemetry data flows through the configuration.
- **Connectors**: [OpenTelemetry Connectors](https://github.com/open-telemetry/opentelemetry-collector/blob/main/connector/README.md)
can be defined in the configuration. Connectors are used to route telemetry between pipelines, such as counting the number of logs
and emitting a metric based on that count.
- **Processors**: Processors can be defined in the configuration without attaching them directly to sources or destinations.
This allows for more flexibility in how processors are used within a configuration. Processors can still be attached to sources
or destinations just like before.

## Options

| Option | Type | Default | Description |
| ------------------ | --------------- | -------- | --------------------------------------------------------------------------- |
| `name` | string | required | The source name. |
| `platform` | string | required | The platform the configuration supports. See the [supported platforms](./bindplane_configuration.md#supported-platforms) section. |
| `labels` | map | optional | Key value pairs representing labels to set on the configuration. |
| `source` | block | optional | One or more source blocks. See the [source block](./bindplane_configuration.md#source-block) section. |
| `destination` | block | optional | One or more destination blocks. See the [destination block](./bindplane_configuration.md#destination-block) section. |
| `extensions` | list(string) | optional | One or more extension names to attach to the configuration. |
| `rollout` | bool | required | Whether or not updates to the configuration should trigger an automatic rollout of the configuration. |
| `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. |

### Source Block

| Option | Type | Default | Description |
| ------------------- | ------------ | -------- | ---------------------------- |
| `name` | string | required | The source name. |
| `processors` | list(string) | optional | One or more processor names to attach to the source. |
| `route` | string | optional | One or more routes to attach to the source. See the [route block](./bindplane_configuration.md#route-block) section. |

### Destination Block

| Option | Type | Default | Description |
| ------------------- | ------------ | -------- | ---------------------------- |
| `name` | string | required | The source name. |
| `processors` | list(string) | optional | One or more processor names to attach to the destination. |

### Rollout Options Block

| Option | Type | Default | Description |
| ------------------- | ------------ | -------- | ---------------------------- |
| `type` | string | required | The type of rollout to perform. Valid values are 'standard' and 'progressive'. |
| `parameters` | list(block) | optional | One or more parameters for the rollout. See the [parameters block](./bindplane_configuration.md#parameters-block) section. |

### Parameters Block

| Option | Type | Default | Description |
| ------------------- | ------------ | -------- | ---------------------------- |
| `name` | string | required | The name of the parameter. |
| `value` | any | required | The value of the parameter. |

### Route Block

| Option | Type | Default | Description |
| ------------------- | ------------ | -------- | ---------------------------- |
| `telemetry_type` | enum | `logs+metrics+traces` | The telemetry type to route. |
| `components` | list(string) | required | One or more components to route the telemetry to. |

Telemetry types include the following
- `logs`
- `metrics`
- `traces`
- `logs+metrics`
- `logs+traces`
- `metrics+traces`
- `logs+metrics+traces` (default)

The following example shows two route blocks, one for all telemetry types and one for traces only.

```tf
# Route all telemetry types to the Datadog destination
route {
components = [
"destinations/${bindplane_destination.datadog.id}"
]
}
# Route only traces to the Google destination
route {
telemetry_type = "traces"
components = [
"destinations/${bindplane_destination.google.id}"
]
}
```

### Supported Platforms

This table should be used as a reference for supported `platform` values.

| Platform | Value |
| ---------------------- | ----------------------- |
| Linux | `linux` |
| Windows | `windows` |
| macOS | `macos` |
| Kubernetes DaemonSet | `kubernetes-daemonset` |
| Kubernetes Deployment | `kubernetes-deployment` |
| OpenShift DaemonSet | `openshift-daemonset` |
| OpenShift Deployment | `openshift-deployment` |

## Examples

This example shows the creation of a `bindplane_configuration_v2` which uses the following resources:
- two [bindplane_source](./bindplane_source.md) resources
- one [bindplane_destination](./bindplane_destination.md) resource
- two [bindplane_processor](./bindplane_processor.md) resources

Routes are configured on the sources to send telemetry data to the destination.

```hcl
resource "bindplane_source" "host" {
rollout = true
name = "my-host"
type = "host"
parameters_json = jsonencode(
[
{
"name": "collection_interval",
"value": 30
},
{
"name": "enable_process",
"value": false
}
]
)
}
resource "bindplane_source" "journald" {
rollout = true
name = "my-journald"
type = "journald"
}
resource "bindplane_destination" "google" {
rollout = true
name = "my-google"
type = "googlecloud"
}
resource "bindplane_processor" "batch" {
rollout = true
name = "my-batch"
type = "batch"
}
resource "bindplane_extension" "pprof" {
rollout = true
name = "my-pprof"
type = "pprof"
parameters_json = jsonencode(
[
{
"name": "listen_address",
"value": "0.0.0.0"
},
{
"name": "tcp_port",
"value": 5000,
}
]
)
}
resource "bindplane_configuration_v2" "configuration" {
// When removing a component from a configuration and deleting that
// component during the same apply, we want to update the configuration
// before the component is deleted.
lifecycle {
create_before_destroy = true
}
rollout = true
name = "my-config"
platform = "linux"
labels = {
environment = "production"
managed-by = "terraform"
}
source {
name = bindplane_source.host.name
route {
components = [
"destinations/${bindplane_destination.google.id}"
]
}
}
source {
name = bindplane_source.journald.name
route {
components = [
"destinations/${bindplane_destination.google.id}"
]
}
}
destination {
name = bindplane_destination.google.name
processors = [
bindplane_processor.batch.name
]
}
extensions = [
bindplane_extension.pprof.name
]
rollout_options {
type = "progressive"
parameters = [
{
name = "stages"
value = [
{
labels = {
env = "stage"
}
name = "stage"
},
{
labels = {
env = "production"
}
name = "production"
}
]
}
]
}
}
```
28 changes: 21 additions & 7 deletions internal/component/route.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright observIQ, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package component

import (
Expand All @@ -8,25 +22,25 @@ import (
)

const (
// Logs route type
// RouteTypeLogs routes logs
RouteTypeLogs = "logs"

// Metrics route type
// RouteTypeMetrics routes metrics
RouteTypeMetrics = "metrics"

// Traces route type
// RouteTypeTraces routes traces
RouteTypeTraces = "traces"

// Logs + Metrics route type
// RouteTypeLogsMetrics routes logs and metrics
RouteTypeLogsMetrics = "logs+metrics"

// Logs + Traces route type
// RouteTypeLogsTraces routes logs and traces
RouteTypeLogsTraces = "logs+traces"

// Metrics + Traces route type
// RouteTypeMetricsTraces routes metrics and traces
RouteTypeMetricsTraces = "metrics+traces"

// Logs + Metrics + Traces route type
// RouteTypeLogsMetricsTraces routes logs, metrics, and traces
RouteTypeLogsMetricsTraces = "logs+metrics+traces"
)

Expand Down
14 changes: 14 additions & 0 deletions internal/component/route_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright observIQ, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package component

import (
Expand Down

0 comments on commit 38b8e83

Please sign in to comment.