Skip to content

Commit

Permalink
docs: autoscaler and integration docs (#1884)
Browse files Browse the repository at this point in the history
  • Loading branch information
staceysalamon-aiven authored Nov 1, 2024
1 parent 2b880be commit b2dfb18
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 26 deletions.
18 changes: 9 additions & 9 deletions docs/data-sources/service_integration_endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
page_title: "aiven_service_integration_endpoint Data Source - terraform-provider-aiven"
subcategory: ""
description: |-
The Service Integration Endpoint data source provides information about the existing Aiven Service Integration Endpoint.
Gets information about an integration endpoint.
---

# aiven_service_integration_endpoint (Data Source)

The Service Integration Endpoint data source provides information about the existing Aiven Service Integration Endpoint.
Gets information about an integration endpoint.

## Example Usage

```terraform
data "aiven_service_integration_endpoint" "myendpoint" {
project = aiven_project.myproject.project
endpoint_name = "<ENDPOINT_NAME>"
data "aiven_service_integration_endpoint" "example_datadog_endpoint" {
project = aiven_project.example_project.project
endpoint_name = "Datadog endpoint"
}
```

Expand All @@ -24,15 +24,15 @@ data "aiven_service_integration_endpoint" "myendpoint" {

### Required

- `endpoint_name` (String) Name of the service integration endpoint
- `project` (String) Project the service integration endpoint belongs to
- `endpoint_name` (String) Name of the service integration endpoint.
- `project` (String) Project the service integration endpoint is in.

### Read-Only

- `autoscaler_user_config` (List of Object) Autoscaler user configurable settings (see [below for nested schema](#nestedatt--autoscaler_user_config))
- `datadog_user_config` (List of Object) Datadog user configurable settings (see [below for nested schema](#nestedatt--datadog_user_config))
- `endpoint_config` (Map of String) Integration endpoint specific backend configuration
- `endpoint_type` (String) Type of the service integration endpoint. The possible values are `autoscaler`, `datadog`, `external_aws_cloudwatch_logs`, `external_aws_cloudwatch_metrics`, `external_aws_s3`, `external_clickhouse`, `external_elasticsearch_logs`, `external_google_cloud_bigquery`, `external_google_cloud_logging`, `external_kafka`, `external_mysql`, `external_opensearch_logs`, `external_postgresql`, `external_prometheus`, `external_redis`, `external_schema_registry`, `external_sumologic_logs`, `jolokia`, `prometheus` and `rsyslog`.
- `endpoint_config` (Map of String) Backend configuration for the endpoint.
- `endpoint_type` (String) The type of service integration endpoint. The possible values are `autoscaler`, `datadog`, `external_aws_cloudwatch_logs`, `external_aws_cloudwatch_metrics`, `external_aws_s3`, `external_clickhouse`, `external_elasticsearch_logs`, `external_google_cloud_bigquery`, `external_google_cloud_logging`, `external_kafka`, `external_mysql`, `external_opensearch_logs`, `external_postgresql`, `external_prometheus`, `external_redis`, `external_schema_registry`, `external_sumologic_logs`, `jolokia`, `prometheus` and `rsyslog`.
- `external_aws_cloudwatch_logs_user_config` (List of Object) ExternalAwsCloudwatchLogs user configurable settings (see [below for nested schema](#nestedatt--external_aws_cloudwatch_logs_user_config))
- `external_aws_cloudwatch_metrics_user_config` (List of Object) ExternalAwsCloudwatchMetrics user configurable settings (see [below for nested schema](#nestedatt--external_aws_cloudwatch_metrics_user_config))
- `external_aws_s3_user_config` (List of Object) ExternalAwsS3 user configurable settings (see [below for nested schema](#nestedatt--external_aws_s3_user_config))
Expand Down
32 changes: 31 additions & 1 deletion docs/resources/service_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,51 @@ description: |-
# aiven_service_integration (Resource)
Creates and manages an Aiven [service integration](https://aiven.io/docs/platform/concepts/service-integration).

-> Services integrations are not supported for services running on hobbyist plans.

You can set up an integration between two Aiven services or an Aiven service and an external
service. For example, you can send metrics from a Kafka service to an M3DB service,
send metrics from an M3DB service to a Grafana service to show dashboards, and send logs from
any service to OpenSearch.

**Services integrations are not supported for services running on hobbyist plans.**
You can also use service integrations to enable and use the [disk autoscaler](https://aiven.io/docs/platform/howto/disk-autoscaler).

~> **Warning**
For services managed by Terraform, removing an autoscaler integration on services with `additional_disk_space` resets the service disk space to the service plan's disk size.
To retain the additional disk space set the service's `additional_disk_space` value manually. If the integration is managed by Terraform but not the service, the disk space is not reset.

For autoscaler and external integrations, you also need an [integration endpoint](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/service_integration_endpoint).

## Example Usage
```terraform
# Integrate Kafka and M3DB services for metrics
resource "aiven_service_integration" "example_integration" {
project = data.aiven_project.example_project.project
integration_type = "metrics"
source_service_name = aiven_kafka.example_kafka.service_name
destination_service_name = aiven_m3db.example_m3db.service_name
}
# Use disk autoscaler with a PostgreSQL service
resource "aiven_service_integration_endpoint" "autoscaler_endpoint" {
project = data.aiven_project.example_project.project
endpoint_name = "disk-autoscaler-200GiB"
endpoint_type = "autoscaler"
autoscaler_user_config {
autoscaling {
cap_gb = 200
type = "autoscale_disk"
}
}
}
resource "aiven_service_integration" "autoscaler_integration" {
project = data.aiven_project.example_project.project
integration_type = "autoscaler"
source_service_name = aiven_pg.example_pg.service_name
destination_endpoint_id = aiven_service_integration_endpoint.autoscaler_endpoint.id
}
```
<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
49 changes: 43 additions & 6 deletions docs/resources/service_integration_endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,52 @@
page_title: "aiven_service_integration_endpoint Resource - terraform-provider-aiven"
subcategory: ""
description: |-
The Service Integration Endpoint resource allows the creation and management of Aiven Service Integration Endpoints.
Creates and manages an integration endpoint.
Integration endpoints let you send data like metrics and logs from Aiven services to external systems. The autoscaler endpoint lets you automatically scale the disk space on your services.
After creating an endpoint, use the service integration resource https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/service_integration to connect it to a service.
---

# aiven_service_integration_endpoint (Resource)

The Service Integration Endpoint resource allows the creation and management of Aiven Service Integration Endpoints.
Creates and manages an integration endpoint.

Integration endpoints let you send data like metrics and logs from Aiven services to external systems. The `autoscaler` endpoint lets you automatically scale the disk space on your services.

After creating an endpoint, use the [service integration resource](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/service_integration) to connect it to a service.

## Example Usage

```terraform
# Datadog endpoint
resource "aiven_service_integration_endpoint" "example_endpoint" {
project = data.aiven_project.example_project.project
endpoint_name = "Datadog endpoint"
endpoint_type = "datadog"
}
# Disk autoscaler endpoint
resource "aiven_service_integration_endpoint" "autoscaler_endpoint" {
project = data.aiven_project.example_project.project
endpoint_name = "disk-autoscaler-200GiB"
endpoint_type = "autoscaler"
autoscaler_user_config {
autoscaling {
cap_gb = 200
type = "autoscale_disk"
}
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `endpoint_name` (String) Name of the service integration endpoint
- `endpoint_type` (String) Type of the service integration endpoint. The possible values are `autoscaler`, `datadog`, `external_aws_cloudwatch_logs`, `external_aws_cloudwatch_metrics`, `external_aws_s3`, `external_clickhouse`, `external_elasticsearch_logs`, `external_google_cloud_bigquery`, `external_google_cloud_logging`, `external_kafka`, `external_mysql`, `external_opensearch_logs`, `external_postgresql`, `external_prometheus`, `external_redis`, `external_schema_registry`, `external_sumologic_logs`, `jolokia`, `prometheus` and `rsyslog`.
- `project` (String) Project the service integration endpoint belongs to
- `endpoint_name` (String) Name of the service integration endpoint.
- `endpoint_type` (String) The type of service integration endpoint. The possible values are `autoscaler`, `datadog`, `external_aws_cloudwatch_logs`, `external_aws_cloudwatch_metrics`, `external_aws_s3`, `external_clickhouse`, `external_elasticsearch_logs`, `external_google_cloud_bigquery`, `external_google_cloud_logging`, `external_kafka`, `external_mysql`, `external_opensearch_logs`, `external_postgresql`, `external_prometheus`, `external_redis`, `external_schema_registry`, `external_sumologic_logs`, `jolokia`, `prometheus` and `rsyslog`.
- `project` (String) Project the service integration endpoint is in.

### Optional

Expand All @@ -45,7 +74,7 @@ The Service Integration Endpoint resource allows the creation and management of

### Read-Only

- `endpoint_config` (Map of String) Integration endpoint specific backend configuration
- `endpoint_config` (Map of String) Backend configuration for the endpoint.
- `id` (String) The ID of this resource.

<a id="nestedblock--autoscaler_user_config"></a>
Expand Down Expand Up @@ -350,3 +379,11 @@ Optional:
- `delete` (String)
- `read` (String)
- `update` (String)

## Import

Import is supported using the following syntax:

```shell
terraform import aiven_service_integration_endpoint.example_endpoint PROJECT/ID
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data "aiven_service_integration_endpoint" "myendpoint" {
project = aiven_project.myproject.project
endpoint_name = "<ENDPOINT_NAME>"
data "aiven_service_integration_endpoint" "example_datadog_endpoint" {
project = aiven_project.example_project.project
endpoint_name = "Datadog endpoint"
}

22 changes: 22 additions & 0 deletions examples/resources/aiven_service_integration/resource.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
# Integrate Kafka and M3DB services for metrics
resource "aiven_service_integration" "example_integration" {
project = data.aiven_project.example_project.project
integration_type = "metrics"
source_service_name = aiven_kafka.example_kafka.service_name
destination_service_name = aiven_m3db.example_m3db.service_name
}

# Use disk autoscaler with a PostgreSQL service
resource "aiven_service_integration_endpoint" "autoscaler_endpoint" {
project = data.aiven_project.example_project.project
endpoint_name = "disk-autoscaler-200GiB"
endpoint_type = "autoscaler"

autoscaler_user_config {
autoscaling {
cap_gb = 200
type = "autoscale_disk"
}
}
}

resource "aiven_service_integration" "autoscaler_integration" {
project = data.aiven_project.example_project.project
integration_type = "autoscaler"
source_service_name = aiven_pg.example_pg.service_name
destination_endpoint_id = aiven_service_integration_endpoint.autoscaler_endpoint.id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import aiven_service_integration_endpoint.example_endpoint PROJECT/ID
20 changes: 20 additions & 0 deletions examples/resources/aiven_service_integration_endpoint/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Datadog endpoint
resource "aiven_service_integration_endpoint" "example_endpoint" {
project = data.aiven_project.example_project.project
endpoint_name = "Datadog endpoint"
endpoint_type = "datadog"
}

# Disk autoscaler endpoint
resource "aiven_service_integration_endpoint" "autoscaler_endpoint" {
project = data.aiven_project.example_project.project
endpoint_name = "disk-autoscaler-200GiB"
endpoint_type = "autoscaler"

autoscaler_user_config {
autoscaling {
cap_gb = 200
type = "autoscale_disk"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ func hasEndpointConfig[T string | service.EndpointType](kind T) bool {
func aivenServiceIntegrationEndpointSchema() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"project": {
Description: "Project the service integration endpoint belongs to",
Description: "Project the service integration endpoint is in.",
ForceNew: true,
Required: true,
Type: schema.TypeString,
},
"endpoint_name": {
ForceNew: true,
Description: "Name of the service integration endpoint",
Description: "Name of the service integration endpoint.",
Required: true,
Type: schema.TypeString,
},
"endpoint_type": {
Description: userconfig.Desc("Type of the service integration endpoint").PossibleValuesString(service.EndpointTypeChoices()...).Build(),
Description: userconfig.Desc("The type of service integration endpoint.").PossibleValuesString(service.EndpointTypeChoices()...).Build(),
ForceNew: true,
Required: true,
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(service.EndpointTypeChoices(), false),
},
"endpoint_config": {
Description: "Integration endpoint specific backend configuration",
Description: "Backend configuration for the endpoint.",
Computed: true,
Type: schema.TypeMap,
Elem: &schema.Schema{Type: schema.TypeString},
Expand All @@ -60,7 +60,12 @@ func aivenServiceIntegrationEndpointSchema() map[string]*schema.Schema {

func ResourceServiceIntegrationEndpoint() *schema.Resource {
return &schema.Resource{
Description: "The Service Integration Endpoint resource allows the creation and management of Aiven Service Integration Endpoints.",
Description: `Creates and manages an integration endpoint.
Integration endpoints let you send data like metrics and logs from Aiven services to external systems. The ` + "`autoscaler`" + ` endpoint lets you automatically scale the disk space on your services.
After creating an endpoint, use the [service integration resource](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/service_integration) to connect it to a service.
`,
CreateContext: common.WithGenClient(resourceServiceIntegrationEndpointCreate),
ReadContext: common.WithGenClient(resourceServiceIntegrationEndpointRead),
UpdateContext: common.WithGenClient(resourceServiceIntegrationEndpointUpdate),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func DatasourceServiceIntegrationEndpoint() *schema.Resource {
return &schema.Resource{
ReadContext: common.WithGenClient(datasourceServiceIntegrationEndpointRead),
Description: "The Service Integration Endpoint data source provides information about the existing Aiven Service Integration Endpoint.",
Description: "Gets information about an integration endpoint.",
Schema: schemautil.ResourceSchemaAsDatasourceSchema(aivenServiceIntegrationEndpointSchema(),
"project", "endpoint_name"),
}
Expand Down
10 changes: 9 additions & 1 deletion templates/resources/service_integration.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ description: |-
# {{.Name}} ({{.Type}})
{{ .Description | trimspace }}

-> Services integrations are not supported for services running on hobbyist plans.

You can set up an integration between two Aiven services or an Aiven service and an external
service. For example, you can send metrics from a Kafka service to an M3DB service,
send metrics from an M3DB service to a Grafana service to show dashboards, and send logs from
any service to OpenSearch.

**Services integrations are not supported for services running on hobbyist plans.**
You can also use service integrations to enable and use the [disk autoscaler](https://aiven.io/docs/platform/howto/disk-autoscaler).

~> **Warning**
For services managed by Terraform, removing an autoscaler integration on services with `additional_disk_space` resets the service disk space to the service plan's disk size.
To retain the additional disk space set the service's `additional_disk_space` value manually. If the integration is managed by Terraform but not the service, the disk space is not reset.

For autoscaler and external integrations, you also need an [integration endpoint](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/service_integration_endpoint).

{{ if .HasExample -}}
## Example Usage
Expand Down

0 comments on commit b2dfb18

Please sign in to comment.