1. Packages
  2. Aiven Provider
  3. API Docs
  4. KafkaConnector
Aiven v6.37.0 published on Thursday, Apr 10, 2025 by Pulumi

aiven.KafkaConnector

Explore with Pulumi AI

Creates and manages Aiven for Apache Kafka® connectors. Source connectors let you import data from an external system into a Kafka topic. Sink connectors let you export data from a topic to an external system.

You can use connectors with any Aiven for Apache Kafka® service that is integrated with an Aiven for Apache Kafka® Connect service.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aiven from "@pulumi/aiven";

const kafka_os_connector = new aiven.KafkaConnector("kafka-os-connector", {
    project: exampleProject.project,
    serviceName: exampleKafka.serviceName,
    connectorName: "kafka-opensearch-connector",
    config: {
        name: "kafka-opensearch-connector",
        topics: exampleTopic.topicName,
        "connector.class": "io.aiven.kafka.connect.opensearch.OpensearchSinkConnector",
        "type.name": "os-connector",
        "connection.url": exampleOs.serviceUri,
        "connection.username": exampleOs.serviceUsername,
        "connection.password": exampleOs.servicePassword,
    },
});
Copy
import pulumi
import pulumi_aiven as aiven

kafka_os_connector = aiven.KafkaConnector("kafka-os-connector",
    project=example_project["project"],
    service_name=example_kafka["serviceName"],
    connector_name="kafka-opensearch-connector",
    config={
        "name": "kafka-opensearch-connector",
        "topics": example_topic["topicName"],
        "connector.class": "io.aiven.kafka.connect.opensearch.OpensearchSinkConnector",
        "type.name": "os-connector",
        "connection.url": example_os["serviceUri"],
        "connection.username": example_os["serviceUsername"],
        "connection.password": example_os["servicePassword"],
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aiven.NewKafkaConnector(ctx, "kafka-os-connector", &aiven.KafkaConnectorArgs{
			Project:       pulumi.Any(exampleProject.Project),
			ServiceName:   pulumi.Any(exampleKafka.ServiceName),
			ConnectorName: pulumi.String("kafka-opensearch-connector"),
			Config: pulumi.StringMap{
				"name":                pulumi.String("kafka-opensearch-connector"),
				"topics":              pulumi.Any(exampleTopic.TopicName),
				"connector.class":     pulumi.String("io.aiven.kafka.connect.opensearch.OpensearchSinkConnector"),
				"type.name":           pulumi.String("os-connector"),
				"connection.url":      pulumi.Any(exampleOs.ServiceUri),
				"connection.username": pulumi.Any(exampleOs.ServiceUsername),
				"connection.password": pulumi.Any(exampleOs.ServicePassword),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aiven = Pulumi.Aiven;

return await Deployment.RunAsync(() => 
{
    var kafka_os_connector = new Aiven.KafkaConnector("kafka-os-connector", new()
    {
        Project = exampleProject.Project,
        ServiceName = exampleKafka.ServiceName,
        ConnectorName = "kafka-opensearch-connector",
        Config = 
        {
            { "name", "kafka-opensearch-connector" },
            { "topics", exampleTopic.TopicName },
            { "connector.class", "io.aiven.kafka.connect.opensearch.OpensearchSinkConnector" },
            { "type.name", "os-connector" },
            { "connection.url", exampleOs.ServiceUri },
            { "connection.username", exampleOs.ServiceUsername },
            { "connection.password", exampleOs.ServicePassword },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aiven.KafkaConnector;
import com.pulumi.aiven.KafkaConnectorArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var kafka_os_connector = new KafkaConnector("kafka-os-connector", KafkaConnectorArgs.builder()
            .project(exampleProject.project())
            .serviceName(exampleKafka.serviceName())
            .connectorName("kafka-opensearch-connector")
            .config(Map.ofEntries(
                Map.entry("name", "kafka-opensearch-connector"),
                Map.entry("topics", exampleTopic.topicName()),
                Map.entry("connector.class", "io.aiven.kafka.connect.opensearch.OpensearchSinkConnector"),
                Map.entry("type.name", "os-connector"),
                Map.entry("connection.url", exampleOs.serviceUri()),
                Map.entry("connection.username", exampleOs.serviceUsername()),
                Map.entry("connection.password", exampleOs.servicePassword())
            ))
            .build());

    }
}
Copy
resources:
  kafka-os-connector:
    type: aiven:KafkaConnector
    properties:
      project: ${exampleProject.project}
      serviceName: ${exampleKafka.serviceName}
      connectorName: kafka-opensearch-connector
      config:
        name: kafka-opensearch-connector
        topics: ${exampleTopic.topicName}
        connector.class: io.aiven.kafka.connect.opensearch.OpensearchSinkConnector
        type.name: os-connector
        connection.url: ${exampleOs.serviceUri}
        connection.username: ${exampleOs.serviceUsername}
        connection.password: ${exampleOs.servicePassword}
Copy

Create KafkaConnector Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new KafkaConnector(name: string, args: KafkaConnectorArgs, opts?: CustomResourceOptions);
@overload
def KafkaConnector(resource_name: str,
                   args: KafkaConnectorArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def KafkaConnector(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   config: Optional[Mapping[str, str]] = None,
                   connector_name: Optional[str] = None,
                   project: Optional[str] = None,
                   service_name: Optional[str] = None)
func NewKafkaConnector(ctx *Context, name string, args KafkaConnectorArgs, opts ...ResourceOption) (*KafkaConnector, error)
public KafkaConnector(string name, KafkaConnectorArgs args, CustomResourceOptions? opts = null)
public KafkaConnector(String name, KafkaConnectorArgs args)
public KafkaConnector(String name, KafkaConnectorArgs args, CustomResourceOptions options)
type: aiven:KafkaConnector
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. KafkaConnectorArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. KafkaConnectorArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. KafkaConnectorArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. KafkaConnectorArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. KafkaConnectorArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var kafkaConnectorResource = new Aiven.KafkaConnector("kafkaConnectorResource", new()
{
    Config = 
    {
        { "string", "string" },
    },
    ConnectorName = "string",
    Project = "string",
    ServiceName = "string",
});
Copy
example, err := aiven.NewKafkaConnector(ctx, "kafkaConnectorResource", &aiven.KafkaConnectorArgs{
	Config: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	ConnectorName: pulumi.String("string"),
	Project:       pulumi.String("string"),
	ServiceName:   pulumi.String("string"),
})
Copy
var kafkaConnectorResource = new KafkaConnector("kafkaConnectorResource", KafkaConnectorArgs.builder()
    .config(Map.of("string", "string"))
    .connectorName("string")
    .project("string")
    .serviceName("string")
    .build());
Copy
kafka_connector_resource = aiven.KafkaConnector("kafkaConnectorResource",
    config={
        "string": "string",
    },
    connector_name="string",
    project="string",
    service_name="string")
Copy
const kafkaConnectorResource = new aiven.KafkaConnector("kafkaConnectorResource", {
    config: {
        string: "string",
    },
    connectorName: "string",
    project: "string",
    serviceName: "string",
});
Copy
type: aiven:KafkaConnector
properties:
    config:
        string: string
    connectorName: string
    project: string
    serviceName: string
Copy

KafkaConnector Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The KafkaConnector resource accepts the following input properties:

Config This property is required. Dictionary<string, string>
The Kafka connector configuration parameters.
ConnectorName
This property is required.
Changes to this property will trigger replacement.
string
The Kafka connector name. Changing this property forces recreation of the resource.
Project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Config This property is required. map[string]string
The Kafka connector configuration parameters.
ConnectorName
This property is required.
Changes to this property will trigger replacement.
string
The Kafka connector name. Changing this property forces recreation of the resource.
Project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
config This property is required. Map<String,String>
The Kafka connector configuration parameters.
connectorName
This property is required.
Changes to this property will trigger replacement.
String
The Kafka connector name. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
config This property is required. {[key: string]: string}
The Kafka connector configuration parameters.
connectorName
This property is required.
Changes to this property will trigger replacement.
string
The Kafka connector name. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
config This property is required. Mapping[str, str]
The Kafka connector configuration parameters.
connector_name
This property is required.
Changes to this property will trigger replacement.
str
The Kafka connector name. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
str
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
service_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
config This property is required. Map<String>
The Kafka connector configuration parameters.
connectorName
This property is required.
Changes to this property will trigger replacement.
String
The Kafka connector name. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the KafkaConnector resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
PluginAuthor string
The Kafka connector author.
PluginClass string
The Kafka connector Java class.
PluginDocUrl string
The Kafka connector documentation URL.
PluginTitle string
The Kafka connector title.
PluginType string
The Kafka connector type.
PluginVersion string
The version of the Kafka connector.
Tasks List<KafkaConnectorTask>
List of tasks of a connector.
Id string
The provider-assigned unique ID for this managed resource.
PluginAuthor string
The Kafka connector author.
PluginClass string
The Kafka connector Java class.
PluginDocUrl string
The Kafka connector documentation URL.
PluginTitle string
The Kafka connector title.
PluginType string
The Kafka connector type.
PluginVersion string
The version of the Kafka connector.
Tasks []KafkaConnectorTask
List of tasks of a connector.
id String
The provider-assigned unique ID for this managed resource.
pluginAuthor String
The Kafka connector author.
pluginClass String
The Kafka connector Java class.
pluginDocUrl String
The Kafka connector documentation URL.
pluginTitle String
The Kafka connector title.
pluginType String
The Kafka connector type.
pluginVersion String
The version of the Kafka connector.
tasks List<KafkaConnectorTask>
List of tasks of a connector.
id string
The provider-assigned unique ID for this managed resource.
pluginAuthor string
The Kafka connector author.
pluginClass string
The Kafka connector Java class.
pluginDocUrl string
The Kafka connector documentation URL.
pluginTitle string
The Kafka connector title.
pluginType string
The Kafka connector type.
pluginVersion string
The version of the Kafka connector.
tasks KafkaConnectorTask[]
List of tasks of a connector.
id str
The provider-assigned unique ID for this managed resource.
plugin_author str
The Kafka connector author.
plugin_class str
The Kafka connector Java class.
plugin_doc_url str
The Kafka connector documentation URL.
plugin_title str
The Kafka connector title.
plugin_type str
The Kafka connector type.
plugin_version str
The version of the Kafka connector.
tasks Sequence[KafkaConnectorTask]
List of tasks of a connector.
id String
The provider-assigned unique ID for this managed resource.
pluginAuthor String
The Kafka connector author.
pluginClass String
The Kafka connector Java class.
pluginDocUrl String
The Kafka connector documentation URL.
pluginTitle String
The Kafka connector title.
pluginType String
The Kafka connector type.
pluginVersion String
The version of the Kafka connector.
tasks List<Property Map>
List of tasks of a connector.

Look up Existing KafkaConnector Resource

Get an existing KafkaConnector resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: KafkaConnectorState, opts?: CustomResourceOptions): KafkaConnector
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        config: Optional[Mapping[str, str]] = None,
        connector_name: Optional[str] = None,
        plugin_author: Optional[str] = None,
        plugin_class: Optional[str] = None,
        plugin_doc_url: Optional[str] = None,
        plugin_title: Optional[str] = None,
        plugin_type: Optional[str] = None,
        plugin_version: Optional[str] = None,
        project: Optional[str] = None,
        service_name: Optional[str] = None,
        tasks: Optional[Sequence[KafkaConnectorTaskArgs]] = None) -> KafkaConnector
func GetKafkaConnector(ctx *Context, name string, id IDInput, state *KafkaConnectorState, opts ...ResourceOption) (*KafkaConnector, error)
public static KafkaConnector Get(string name, Input<string> id, KafkaConnectorState? state, CustomResourceOptions? opts = null)
public static KafkaConnector get(String name, Output<String> id, KafkaConnectorState state, CustomResourceOptions options)
resources:  _:    type: aiven:KafkaConnector    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Config Dictionary<string, string>
The Kafka connector configuration parameters.
ConnectorName Changes to this property will trigger replacement. string
The Kafka connector name. Changing this property forces recreation of the resource.
PluginAuthor string
The Kafka connector author.
PluginClass string
The Kafka connector Java class.
PluginDocUrl string
The Kafka connector documentation URL.
PluginTitle string
The Kafka connector title.
PluginType string
The Kafka connector type.
PluginVersion string
The version of the Kafka connector.
Project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Tasks List<KafkaConnectorTask>
List of tasks of a connector.
Config map[string]string
The Kafka connector configuration parameters.
ConnectorName Changes to this property will trigger replacement. string
The Kafka connector name. Changing this property forces recreation of the resource.
PluginAuthor string
The Kafka connector author.
PluginClass string
The Kafka connector Java class.
PluginDocUrl string
The Kafka connector documentation URL.
PluginTitle string
The Kafka connector title.
PluginType string
The Kafka connector type.
PluginVersion string
The version of the Kafka connector.
Project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Tasks []KafkaConnectorTaskArgs
List of tasks of a connector.
config Map<String,String>
The Kafka connector configuration parameters.
connectorName Changes to this property will trigger replacement. String
The Kafka connector name. Changing this property forces recreation of the resource.
pluginAuthor String
The Kafka connector author.
pluginClass String
The Kafka connector Java class.
pluginDocUrl String
The Kafka connector documentation URL.
pluginTitle String
The Kafka connector title.
pluginType String
The Kafka connector type.
pluginVersion String
The version of the Kafka connector.
project Changes to this property will trigger replacement. String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
tasks List<KafkaConnectorTask>
List of tasks of a connector.
config {[key: string]: string}
The Kafka connector configuration parameters.
connectorName Changes to this property will trigger replacement. string
The Kafka connector name. Changing this property forces recreation of the resource.
pluginAuthor string
The Kafka connector author.
pluginClass string
The Kafka connector Java class.
pluginDocUrl string
The Kafka connector documentation URL.
pluginTitle string
The Kafka connector title.
pluginType string
The Kafka connector type.
pluginVersion string
The version of the Kafka connector.
project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
tasks KafkaConnectorTask[]
List of tasks of a connector.
config Mapping[str, str]
The Kafka connector configuration parameters.
connector_name Changes to this property will trigger replacement. str
The Kafka connector name. Changing this property forces recreation of the resource.
plugin_author str
The Kafka connector author.
plugin_class str
The Kafka connector Java class.
plugin_doc_url str
The Kafka connector documentation URL.
plugin_title str
The Kafka connector title.
plugin_type str
The Kafka connector type.
plugin_version str
The version of the Kafka connector.
project Changes to this property will trigger replacement. str
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
service_name Changes to this property will trigger replacement. str
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
tasks Sequence[KafkaConnectorTaskArgs]
List of tasks of a connector.
config Map<String>
The Kafka connector configuration parameters.
connectorName Changes to this property will trigger replacement. String
The Kafka connector name. Changing this property forces recreation of the resource.
pluginAuthor String
The Kafka connector author.
pluginClass String
The Kafka connector Java class.
pluginDocUrl String
The Kafka connector documentation URL.
pluginTitle String
The Kafka connector title.
pluginType String
The Kafka connector type.
pluginVersion String
The version of the Kafka connector.
project Changes to this property will trigger replacement. String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
tasks List<Property Map>
List of tasks of a connector.

Supporting Types

KafkaConnectorTask
, KafkaConnectorTaskArgs

Connector string
The name of the related connector.
Task int
The task ID of the task.
Connector string
The name of the related connector.
Task int
The task ID of the task.
connector String
The name of the related connector.
task Integer
The task ID of the task.
connector string
The name of the related connector.
task number
The task ID of the task.
connector str
The name of the related connector.
task int
The task ID of the task.
connector String
The name of the related connector.
task Number
The task ID of the task.

Import

$ pulumi import aiven:index/kafkaConnector:KafkaConnector kafka-os-connector PROJECT/SERVICE_NAME/CONNECTOR_NAME
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Aiven pulumi/pulumi-aiven
License
Apache-2.0
Notes
This Pulumi package is based on the aiven Terraform Provider.