Connector class

A Managed Service for Kafka Connect Connectors.

Example Usage

Managedkafka Connector Basic

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

const project = gcp.organizations.getProject({});
const mkcSecondarySubnet = new gcp.compute.Subnetwork("mkc_secondary_subnet", {
    project: project.then(project => project.projectId),
    name: "my-secondary-subnetwork-00",
    ipCidrRange: "10.5.0.0/16",
    region: "us-central1",
    network: "default",
});
const cpsTopic = new gcp.pubsub.Topic("cps_topic", {
    project: project.then(project => project.projectId),
    name: "my-cps-topic",
    messageRetentionDuration: "86600s",
});
const gmkCluster = new gcp.managedkafka.Cluster("gmk_cluster", {
    clusterId: "my-cluster",
    location: "us-central1",
    capacityConfig: {
        vcpuCount: "3",
        memoryBytes: "3221225472",
    },
    gcpConfig: {
        accessConfig: {
            networkConfigs: [{
                subnet: project.then(project => `projects/${project.number}/regions/us-central1/subnetworks/default`),
            }],
        },
    },
});
const gmkTopic = new gcp.managedkafka.Topic("gmk_topic", {
    topicId: "my-topic",
    cluster: gmkCluster.clusterId,
    location: "us-central1",
    partitionCount: 2,
    replicationFactor: 3,
});
const mkcCluster = new gcp.managedkafka.ConnectCluster("mkc_cluster", {
    connectClusterId: "my-connect-cluster",
    kafkaCluster: pulumi.all([project, gmkCluster.clusterId]).apply(([project, clusterId]) => `projects/${project.projectId}/locations/us-central1/clusters/${clusterId}`),
    location: "us-central1",
    capacityConfig: {
        vcpuCount: "12",
        memoryBytes: "21474836480",
    },
    gcpConfig: {
        accessConfig: {
            networkConfigs: [{
                primarySubnet: project.then(project => `projects/${project.number}/regions/us-central1/subnetworks/default`),
                additionalSubnets: [mkcSecondarySubnet.id],
                dnsDomainNames: [pulumi.all([gmkCluster.clusterId, project]).apply(([clusterId, project]) => `${clusterId}.us-central1.managedkafka.${project.projectId}.cloud.goog`)],
            }],
        },
    },
    labels: {
        key: "value",
    },
});
const example = new gcp.managedkafka.Connector("example", {
    connectorId: "my-connector",
    connectCluster: mkcCluster.connectClusterId,
    location: "us-central1",
    configs: {
        "connector.class": "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector",
        name: "my-connector",
        "tasks.max": "3",
        topics: gmkTopic.topicId,
        "cps.topic": cpsTopic.name,
        "cps.project": project.then(project => project.projectId),
        "value.converter": "org.apache.kafka.connect.storage.StringConverter",
        "key.converter": "org.apache.kafka.connect.storage.StringConverter",
    },
    taskRestartPolicy: {
        minimumBackoff: "60s",
        maximumBackoff: "1800s",
    },
});
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
mkc_secondary_subnet = gcp.compute.Subnetwork("mkc_secondary_subnet",
    project=project.project_id,
    name="my-secondary-subnetwork-00",
    ip_cidr_range="10.5.0.0/16",
    region="us-central1",
    network="default")
cps_topic = gcp.pubsub.Topic("cps_topic",
    project=project.project_id,
    name="my-cps-topic",
    message_retention_duration="86600s")
gmk_cluster = gcp.managedkafka.Cluster("gmk_cluster",
    cluster_id="my-cluster",
    location="us-central1",
    capacity_config={
        "vcpu_count": "3",
        "memory_bytes": "3221225472",
    },
    gcp_config={
        "access_config": {
            "network_configs": [{
                "subnet": f"projects/{project.number}/regions/us-central1/subnetworks/default",
            }],
        },
    })
gmk_topic = gcp.managedkafka.Topic("gmk_topic",
    topic_id="my-topic",
    cluster=gmk_cluster.cluster_id,
    location="us-central1",
    partition_count=2,
    replication_factor=3)
mkc_cluster = gcp.managedkafka.ConnectCluster("mkc_cluster",
    connect_cluster_id="my-connect-cluster",
    kafka_cluster=gmk_cluster.cluster_id.apply(lambda cluster_id: f"projects/{project.project_id}/locations/us-central1/clusters/{cluster_id}"),
    location="us-central1",
    capacity_config={
        "vcpu_count": "12",
        "memory_bytes": "21474836480",
    },
    gcp_config={
        "access_config": {
            "network_configs": [{
                "primary_subnet": f"projects/{project.number}/regions/us-central1/subnetworks/default",
                "additional_subnets": [mkc_secondary_subnet.id],
                "dns_domain_names": [gmk_cluster.cluster_id.apply(lambda cluster_id: f"{cluster_id}.us-central1.managedkafka.{project.project_id}.cloud.goog")],
            }],
        },
    },
    labels={
        "key": "value",
    })
example = gcp.managedkafka.Connector("example",
    connector_id="my-connector",
    connect_cluster=mkc_cluster.connect_cluster_id,
    location="us-central1",
    configs={
        "connector.class": "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector",
        "name": "my-connector",
        "tasks.max": "3",
        "topics": gmk_topic.topic_id,
        "cps.topic": cps_topic.name,
        "cps.project": project.project_id,
        "value.converter": "org.apache.kafka.connect.storage.StringConverter",
        "key.converter": "org.apache.kafka.connect.storage.StringConverter",
    },
    task_restart_policy={
        "minimum_backoff": "60s",
        "maximum_backoff": "1800s",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var mkcSecondarySubnet = new Gcp.Compute.Subnetwork("mkc_secondary_subnet", new()
    {
        Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
        Name = "my-secondary-subnetwork-00",
        IpCidrRange = "10.5.0.0/16",
        Region = "us-central1",
        Network = "default",
    });

    var cpsTopic = new Gcp.PubSub.Topic("cps_topic", new()
    {
        Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
        Name = "my-cps-topic",
        MessageRetentionDuration = "86600s",
    });

    var gmkCluster = new Gcp.ManagedKafka.Cluster("gmk_cluster", new()
    {
        ClusterId = "my-cluster",
        Location = "us-central1",
        CapacityConfig = new Gcp.ManagedKafka.Inputs.ClusterCapacityConfigArgs
        {
            VcpuCount = "3",
            MemoryBytes = "3221225472",
        },
        GcpConfig = new Gcp.ManagedKafka.Inputs.ClusterGcpConfigArgs
        {
            AccessConfig = new Gcp.ManagedKafka.Inputs.ClusterGcpConfigAccessConfigArgs
            {
                NetworkConfigs = new[]
                {
                    new Gcp.ManagedKafka.Inputs.ClusterGcpConfigAccessConfigNetworkConfigArgs
                    {
                        Subnet = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-central1/subnetworks/default",
                    },
                },
            },
        },
    });

    var gmkTopic = new Gcp.ManagedKafka.Topic("gmk_topic", new()
    {
        TopicId = "my-topic",
        Cluster = gmkCluster.ClusterId,
        Location = "us-central1",
        PartitionCount = 2,
        ReplicationFactor = 3,
    });

    var mkcCluster = new Gcp.ManagedKafka.ConnectCluster("mkc_cluster", new()
    {
        ConnectClusterId = "my-connect-cluster",
        KafkaCluster = Output.Tuple(project, gmkCluster.ClusterId).Apply(values =>
        {
            var project = values.Item1;
            var clusterId = values.Item2;
            return $"projects/{project.Apply(getProjectResult => getProjectResult.ProjectId)}/locations/us-central1/clusters/{clusterId}";
        }),
        Location = "us-central1",
        CapacityConfig = new Gcp.ManagedKafka.Inputs.ConnectClusterCapacityConfigArgs
        {
            VcpuCount = "12",
            MemoryBytes = "21474836480",
        },
        GcpConfig = new Gcp.ManagedKafka.Inputs.ConnectClusterGcpConfigArgs
        {
            AccessConfig = new Gcp.ManagedKafka.Inputs.ConnectClusterGcpConfigAccessConfigArgs
            {
                NetworkConfigs = new[]
                {
                    new Gcp.ManagedKafka.Inputs.ConnectClusterGcpConfigAccessConfigNetworkConfigArgs
                    {
                        PrimarySubnet = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-central1/subnetworks/default",
                        AdditionalSubnets = new[]
                        {
                            mkcSecondarySubnet.Id,
                        },
                        DnsDomainNames = new[]
                        {
                            Output.Tuple(gmkCluster.ClusterId, project).Apply(values =>
                            {
                                var clusterId = values.Item1;
                                var project = values.Item2;
                                return $"{clusterId}.us-central1.managedkafka.{project.Apply(getProjectResult => getProjectResult.ProjectId)}.cloud.goog";
                            }),
                        },
                    },
                },
            },
        },
        Labels =
        {
            { "key", "value" },
        },
    });

    var example = new Gcp.ManagedKafka.Connector("example", new()
    {
        ConnectorId = "my-connector",
        ConnectCluster = mkcCluster.ConnectClusterId,
        Location = "us-central1",
        Configs =
        {
            { "connector.class", "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector" },
            { "name", "my-connector" },
            { "tasks.max", "3" },
            { "topics", gmkTopic.TopicId },
            { "cps.topic", cpsTopic.Name },
            { "cps.project", project.Apply(getProjectResult => getProjectResult.ProjectId) },
            { "value.converter", "org.apache.kafka.connect.storage.StringConverter" },
            { "key.converter", "org.apache.kafka.connect.storage.StringConverter" },
        },
        TaskRestartPolicy = new Gcp.ManagedKafka.Inputs.ConnectorTaskRestartPolicyArgs
        {
            MinimumBackoff = "60s",
            MaximumBackoff = "1800s",
        },
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/managedkafka"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/pubsub"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		mkcSecondarySubnet, err := compute.NewSubnetwork(ctx, "mkc_secondary_subnet", &compute.SubnetworkArgs{
			Project:     pulumi.String(project.ProjectId),
			Name:        pulumi.String("my-secondary-subnetwork-00"),
			IpCidrRange: pulumi.String("10.5.0.0/16"),
			Region:      pulumi.String("us-central1"),
			Network:     pulumi.String("default"),
		})
		if err != nil {
			return err
		}
		cpsTopic, err := pubsub.NewTopic(ctx, "cps_topic", &pubsub.TopicArgs{
			Project:                  pulumi.String(project.ProjectId),
			Name:                     pulumi.String("my-cps-topic"),
			MessageRetentionDuration: pulumi.String("86600s"),
		})
		if err != nil {
			return err
		}
		gmkCluster, err := managedkafka.NewCluster(ctx, "gmk_cluster", &managedkafka.ClusterArgs{
			ClusterId: pulumi.String("my-cluster"),
			Location:  pulumi.String("us-central1"),
			CapacityConfig: &managedkafka.ClusterCapacityConfigArgs{
				VcpuCount:   pulumi.String("3"),
				MemoryBytes: pulumi.String("3221225472"),
			},
			GcpConfig: &managedkafka.ClusterGcpConfigArgs{
				AccessConfig: &managedkafka.ClusterGcpConfigAccessConfigArgs{
					NetworkConfigs: managedkafka.ClusterGcpConfigAccessConfigNetworkConfigArray{
						&managedkafka.ClusterGcpConfigAccessConfigNetworkConfigArgs{
							Subnet: pulumi.Sprintf("projects/%v/regions/us-central1/subnetworks/default", project.Number),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		gmkTopic, err := managedkafka.NewTopic(ctx, "gmk_topic", &managedkafka.TopicArgs{
			TopicId:           pulumi.String("my-topic"),
			Cluster:           gmkCluster.ClusterId,
			Location:          pulumi.String("us-central1"),
			PartitionCount:    pulumi.Int(2),
			ReplicationFactor: pulumi.Int(3),
		})
		if err != nil {
			return err
		}
		mkcCluster, err := managedkafka.NewConnectCluster(ctx, "mkc_cluster", &managedkafka.ConnectClusterArgs{
			ConnectClusterId: pulumi.String("my-connect-cluster"),
			KafkaCluster: gmkCluster.ClusterId.ApplyT(func(clusterId string) (string, error) {
				return fmt.Sprintf("projects/%v/locations/us-central1/clusters/%v", project.ProjectId, clusterId), nil
			}).(pulumi.StringOutput),
			Location: pulumi.String("us-central1"),
			CapacityConfig: &managedkafka.ConnectClusterCapacityConfigArgs{
				VcpuCount:   pulumi.String("12"),
				MemoryBytes: pulumi.String("21474836480"),
			},
			GcpConfig: &managedkafka.ConnectClusterGcpConfigArgs{
				AccessConfig: &managedkafka.ConnectClusterGcpConfigAccessConfigArgs{
					NetworkConfigs: managedkafka.ConnectClusterGcpConfigAccessConfigNetworkConfigArray{
						&managedkafka.ConnectClusterGcpConfigAccessConfigNetworkConfigArgs{
							PrimarySubnet: pulumi.Sprintf("projects/%v/regions/us-central1/subnetworks/default", project.Number),
							AdditionalSubnets: pulumi.StringArray{
								mkcSecondarySubnet.ID().ToIDOutput().ToStringOutput(),
							},
							DnsDomainNames: pulumi.StringArray{
								gmkCluster.ClusterId.ApplyT(func(clusterId string) (string, error) {
									return fmt.Sprintf("%v.us-central1.managedkafka.%v.cloud.goog", clusterId, project.ProjectId), nil
								}).(pulumi.StringOutput),
							},
						},
					},
				},
			},
			Labels: pulumi.StringMap{
				"key": pulumi.String("value"),
			},
		})
		if err != nil {
			return err
		}
		_, err = managedkafka.NewConnector(ctx, "example", &managedkafka.ConnectorArgs{
			ConnectorId:    pulumi.String("my-connector"),
			ConnectCluster: mkcCluster.ConnectClusterId,
			Location:       pulumi.String("us-central1"),
			Configs: pulumi.StringMap{
				"connector.class": pulumi.String("com.google.pubsub.kafka.sink.CloudPubSubSinkConnector"),
				"name":            pulumi.String("my-connector"),
				"tasks.max":       pulumi.String("3"),
				"topics":          gmkTopic.TopicId,
				"cps.topic":       cpsTopic.Name,
				"cps.project":     pulumi.String(project.ProjectId),
				"value.converter": pulumi.String("org.apache.kafka.connect.storage.StringConverter"),
				"key.converter":   pulumi.String("org.apache.kafka.connect.storage.StringConverter"),
			},
			TaskRestartPolicy: &managedkafka.ConnectorTaskRestartPolicyArgs{
				MinimumBackoff: pulumi.String("60s"),
				MaximumBackoff: pulumi.String("1800s"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}

resource "gcp_compute_subnetwork" "mkc_secondary_subnet" {
  project       = data.gcp_organizations_getproject.project.project_id
  name          = "my-secondary-subnetwork-00"
  ip_cidr_range = "10.5.0.0/16"
  region        = "us-central1"
  network       = "default"
}
resource "gcp_pubsub_topic" "cps_topic" {
  project                    = data.gcp_organizations_getproject.project.project_id
  name                       = "my-cps-topic"
  message_retention_duration = "86600s"
}
resource "gcp_managedkafka_cluster" "gmk_cluster" {
  cluster_id = "my-cluster"
  location   = "us-central1"
  capacity_config = {
    vcpu_count   = 3
    memory_bytes = 3221225472
  }
  gcp_config = {
    access_config = {
      network_configs = [{
        "subnet" ="projects/${data.gcp_organizations_getproject.project.number}/regions/us-central1/subnetworks/default"
      }]
    }
  }
}
resource "gcp_managedkafka_topic" "gmk_topic" {
  topic_id           = "my-topic"
  cluster            = gcp_managedkafka_cluster.gmk_cluster.cluster_id
  location           = "us-central1"
  partition_count    = 2
  replication_factor = 3
}
resource "gcp_managedkafka_connectcluster" "mkc_cluster" {
  connect_cluster_id = "my-connect-cluster"
  kafka_cluster      ="projects/${data.gcp_organizations_getproject.project.project_id}/locations/us-central1/clusters/${gcp_managedkafka_cluster.gmk_cluster.cluster_id}"
  location           = "us-central1"
  capacity_config = {
    vcpu_count   = 12
    memory_bytes = 21474836480
  }
  gcp_config = {
    access_config = {
      network_configs = [{
        "primarySubnet"     ="projects/${data.gcp_organizations_getproject.project.number}/regions/us-central1/subnetworks/default"
        "additionalSubnets" = [gcp_compute_subnetwork.mkc_secondary_subnet.id]
        "dnsDomainNames"    = ["${gcp_managedkafka_cluster.gmk_cluster.cluster_id}.us-central1.managedkafka.${data.gcp_organizations_getproject.project.project_id}.cloud.goog"]
      }]
    }
  }
  labels = {
    "key" = "value"
  }
}
resource "gcp_managedkafka_connector" "example" {
  connector_id    = "my-connector"
  connect_cluster = gcp_managedkafka_connectcluster.mkc_cluster.connect_cluster_id
  location        = "us-central1"
  configs = {
    "connector.class" = "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector"
    "name"            = "my-connector"
    "tasks.max"       = "3"
    "topics"          = gcp_managedkafka_topic.gmk_topic.topic_id
    "cps.topic"       = gcp_pubsub_topic.cps_topic.name
    "cps.project"     = data.gcp_organizations_getproject.project.project_id
    "value.converter" = "org.apache.kafka.connect.storage.StringConverter"
    "key.converter"   = "org.apache.kafka.connect.storage.StringConverter"
  }
  task_restart_policy = {
    minimum_backoff = "60s"
    maximum_backoff = "1800s"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.compute.Subnetwork;
import com.pulumi.gcp.compute.SubnetworkArgs;
import com.pulumi.gcp.managedkafka.Cluster;
import com.pulumi.gcp.managedkafka.ClusterArgs;
import com.pulumi.gcp.managedkafka.inputs.ClusterCapacityConfigArgs;
import com.pulumi.gcp.managedkafka.inputs.ClusterGcpConfigArgs;
import com.pulumi.gcp.managedkafka.inputs.ClusterGcpConfigAccessConfigArgs;
import com.pulumi.gcp.managedkafka.inputs.ClusterGcpConfigAccessConfigNetworkConfigArgs;
import com.pulumi.gcp.managedkafka.ConnectCluster;
import com.pulumi.gcp.managedkafka.ConnectClusterArgs;
import com.pulumi.gcp.managedkafka.inputs.ConnectClusterCapacityConfigArgs;
import com.pulumi.gcp.managedkafka.inputs.ConnectClusterGcpConfigArgs;
import com.pulumi.gcp.managedkafka.inputs.ConnectClusterGcpConfigAccessConfigArgs;
import com.pulumi.gcp.managedkafka.inputs.ConnectClusterGcpConfigAccessConfigNetworkConfigArgs;
import com.pulumi.gcp.managedkafka.Connector;
import com.pulumi.gcp.managedkafka.ConnectorArgs;
import com.pulumi.gcp.managedkafka.inputs.ConnectorTaskRestartPolicyArgs;
import java.util.ArrayList;
import java.util.Arrays;
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) {
        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

        var mkcSecondarySubnet = new Subnetwork("mkcSecondarySubnet", SubnetworkArgs.builder()
            .project(project.projectId())
            .name("my-secondary-subnetwork-00")
            .ipCidrRange("10.5.0.0/16")
            .region("us-central1")
            .network("default")
            .build());

        var cpsTopic = new com.pulumi.gcp.pubsub.Topic("cpsTopic", com.pulumi.gcp.pubsub.TopicArgs.builder()
            .project(project.projectId())
            .name("my-cps-topic")
            .messageRetentionDuration("86600s")
            .build());

        var gmkCluster = new Cluster("gmkCluster", ClusterArgs.builder()
            .clusterId("my-cluster")
            .location("us-central1")
            .capacityConfig(ClusterCapacityConfigArgs.builder()
                .vcpuCount("3")
                .memoryBytes("3221225472")
                .build())
            .gcpConfig(ClusterGcpConfigArgs.builder()
                .accessConfig(ClusterGcpConfigAccessConfigArgs.builder()
                    .networkConfigs(ClusterGcpConfigAccessConfigNetworkConfigArgs.builder()
                        .subnet(String.format("projects/%s/regions/us-central1/subnetworks/default", project.number()))
                        .build())
                    .build())
                .build())
            .build());

        var gmkTopic = new com.pulumi.gcp.managedkafka.Topic("gmkTopic", com.pulumi.gcp.managedkafka.TopicArgs.builder()
            .topicId("my-topic")
            .cluster(gmkCluster.clusterId())
            .location("us-central1")
            .partitionCount(2)
            .replicationFactor(3)
            .build());

        var mkcCluster = new ConnectCluster("mkcCluster", ConnectClusterArgs.builder()
            .connectClusterId("my-connect-cluster")
            .kafkaCluster(gmkCluster.clusterId().applyValue(_clusterId -> String.format("projects/%s/locations/us-central1/clusters/%s", project.projectId(),_clusterId)))
            .location("us-central1")
            .capacityConfig(ConnectClusterCapacityConfigArgs.builder()
                .vcpuCount("12")
                .memoryBytes("21474836480")
                .build())
            .gcpConfig(ConnectClusterGcpConfigArgs.builder()
                .accessConfig(ConnectClusterGcpConfigAccessConfigArgs.builder()
                    .networkConfigs(ConnectClusterGcpConfigAccessConfigNetworkConfigArgs.builder()
                        .primarySubnet(String.format("projects/%s/regions/us-central1/subnetworks/default", project.number()))
                        .additionalSubnets(mkcSecondarySubnet.id())
                        .dnsDomainNames(gmkCluster.clusterId().applyValue(_clusterId -> String.format("%s.us-central1.managedkafka.%s.cloud.goog", _clusterId,project.projectId())))
                        .build())
                    .build())
                .build())
            .labels(Map.of("key", "value"))
            .build());

        var example = new Connector("example", ConnectorArgs.builder()
            .connectorId("my-connector")
            .connectCluster(mkcCluster.connectClusterId())
            .location("us-central1")
            .configs(Map.ofEntries(
                Map.entry("connector.class", "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector"),
                Map.entry("name", "my-connector"),
                Map.entry("tasks.max", "3"),
                Map.entry("topics", gmkTopic.topicId()),
                Map.entry("cps.topic", cpsTopic.name()),
                Map.entry("cps.project", project.projectId()),
                Map.entry("value.converter", "org.apache.kafka.connect.storage.StringConverter"),
                Map.entry("key.converter", "org.apache.kafka.connect.storage.StringConverter")
            ))
            .taskRestartPolicy(ConnectorTaskRestartPolicyArgs.builder()
                .minimumBackoff("60s")
                .maximumBackoff("1800s")
                .build())
            .build());

    }
}
resources:
  mkcSecondarySubnet:
    type: gcp:compute:Subnetwork
    name: mkc_secondary_subnet
    properties:
      project: ${project.projectId}
      name: my-secondary-subnetwork-00
      ipCidrRange: 10.5.0.0/16
      region: us-central1
      network: default
  cpsTopic:
    type: gcp:pubsub:Topic
    name: cps_topic
    properties:
      project: ${project.projectId}
      name: my-cps-topic
      messageRetentionDuration: 86600s
  gmkCluster:
    type: gcp:managedkafka:Cluster
    name: gmk_cluster
    properties:
      clusterId: my-cluster
      location: us-central1
      capacityConfig:
        vcpuCount: 3
        memoryBytes: 3.221225472e+09
      gcpConfig:
        accessConfig:
          networkConfigs:
            - subnet: projects/${project.number}/regions/us-central1/subnetworks/default
  gmkTopic:
    type: gcp:managedkafka:Topic
    name: gmk_topic
    properties:
      topicId: my-topic
      cluster: ${gmkCluster.clusterId}
      location: us-central1
      partitionCount: 2
      replicationFactor: 3
  mkcCluster:
    type: gcp:managedkafka:ConnectCluster
    name: mkc_cluster
    properties:
      connectClusterId: my-connect-cluster
      kafkaCluster: projects/${project.projectId}/locations/us-central1/clusters/${gmkCluster.clusterId}
      location: us-central1
      capacityConfig:
        vcpuCount: 12
        memoryBytes: 2.147483648e+10
      gcpConfig:
        accessConfig:
          networkConfigs:
            - primarySubnet: projects/${project.number}/regions/us-central1/subnetworks/default
              additionalSubnets:
                - ${mkcSecondarySubnet.id}
              dnsDomainNames:
                - ${gmkCluster.clusterId}.us-central1.managedkafka.${project.projectId}.cloud.goog
      labels:
        key: value
  example:
    type: gcp:managedkafka:Connector
    properties:
      connectorId: my-connector
      connectCluster: ${mkcCluster.connectClusterId}
      location: us-central1
      configs:
        connector.class: com.google.pubsub.kafka.sink.CloudPubSubSinkConnector
        name: my-connector
        tasks.max: '3'
        topics: ${gmkTopic.topicId}
        cps.topic: ${cpsTopic.name}
        cps.project: ${project.projectId}
        value.converter: org.apache.kafka.connect.storage.StringConverter
        key.converter: org.apache.kafka.connect.storage.StringConverter
      taskRestartPolicy:
        minimumBackoff: 60s
        maximumBackoff: 1800s
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

Import

Connector can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster}}/connectors/{{connector_id}}
  • {{project}}/{{location}}/{{connect_cluster}}/{{connector_id}}
  • {{location}}/{{connect_cluster}}/{{connector_id}}

When using the pulumi import command, Connector can be imported using one of the formats above. For example:

$ pulumi import gcp:managedkafka/connector:Connector default projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster}}/connectors/{{connector_id}}
$ pulumi import gcp:managedkafka/connector:Connector default {{project}}/{{location}}/{{connect_cluster}}/{{connector_id}}
$ pulumi import gcp:managedkafka/connector:Connector default {{location}}/{{connect_cluster}}/{{connector_id}}

Constructors

Connector(String name, {ConnectorArgs? args, CustomResourceOptions? options})
Creates a new Connector. name The Pulumi resource name. args Arguments used to configure this Connector. The set of arguments for Connector. options Resource options controlling this resource's behavior.
Connector.reference(String urn)
Creates a typed reference to an existing Connector resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
configs ↔ Output<Map<String, String>?>
Connector config as keys/values. The keys of the map are connector property names, for example: connector.class, tasks.max, key.converter.
latefinal
connectCluster ↔ Output<String>
The connect cluster name.
latefinal
connectorId ↔ Output<String>
The ID to use for the connector, which will become the final component of the connector's name. This value is structured like: my-connector-id.
latefinal
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
location ↔ Output<String>
ID of the location of the Kafka Connect resource. See https://cloud.google.com/managed-kafka/docs/locations for a list of supported locations.
latefinal
name ↔ Output<String>
The name of the connector. The connector segment is used when connecting directly to the connect cluster. Structured like: projects/PROJECT_ID/locations/LOCATION/connectClusters/CONNECT_CLUSTER/connectors/CONNECTOR_ID.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state ↔ Output<String>
The current state of the connect. Possible values: STATE_UNSPECIFIED, UNASSIGNED, RUNNING, PAUSED, FAILED, RESTARTING, and STOPPED.
latefinal
taskRestartPolicy ↔ Output<ConnectorTaskRestartPolicy?>
A policy that specifies how to restart the failed connectors/tasks in a Cluster resource. If not set, the failed connectors/tasks won't be restarted. Structure is documented below.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ConnectorState? state, CustomResourceOptions? options}) → Connector
Gets an existing Connector resource's state with the given name and id.