ConnectCluster class

A Managed Service for Kafka Connect cluster.

Example Usage

Managedkafka Connect Cluster 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",
    ipCidrRange: "10.3.0.0/16",
    region: "us-central1",
    network: "default",
});
const cluster = new gcp.managedkafka.Cluster("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 example = new gcp.managedkafka.ConnectCluster("example", {
    connectClusterId: "my-connect-cluster",
    kafkaCluster: pulumi.all([project, cluster.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([cluster.clusterId, project]).apply(([clusterId, project]) => `${clusterId}.us-central1.managedkafka.${project.projectId}.cloud.goog`)],
            }],
        },
    },
    labels: {
        key: "value",
    },
});
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",
    ip_cidr_range="10.3.0.0/16",
    region="us-central1",
    network="default")
cluster = gcp.managedkafka.Cluster("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",
            }],
        },
    })
example = gcp.managedkafka.ConnectCluster("example",
    connect_cluster_id="my-connect-cluster",
    kafka_cluster=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": [cluster.cluster_id.apply(lambda cluster_id: f"{cluster_id}.us-central1.managedkafka.{project.project_id}.cloud.goog")],
            }],
        },
    },
    labels={
        "key": "value",
    })
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",
        IpCidrRange = "10.3.0.0/16",
        Region = "us-central1",
        Network = "default",
    });

    var cluster = new Gcp.ManagedKafka.Cluster("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 example = new Gcp.ManagedKafka.ConnectCluster("example", new()
    {
        ConnectClusterId = "my-connect-cluster",
        KafkaCluster = Output.Tuple(project, cluster.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(cluster.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" },
        },
    });

});
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/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"),
			IpCidrRange: pulumi.String("10.3.0.0/16"),
			Region:      pulumi.String("us-central1"),
			Network:     pulumi.String("default"),
		})
		if err != nil {
			return err
		}
		cluster, err := managedkafka.NewCluster(ctx, "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
		}
		_, err = managedkafka.NewConnectCluster(ctx, "example", &managedkafka.ConnectClusterArgs{
			ConnectClusterId: pulumi.String("my-connect-cluster"),
			KafkaCluster: cluster.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{
								cluster.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
		}
		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"
  ip_cidr_range = "10.3.0.0/16"
  region        = "us-central1"
  network       = "default"
}
resource "gcp_managedkafka_cluster" "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_connectcluster" "example" {
  connect_cluster_id = "my-connect-cluster"
  kafka_cluster      ="projects/${data.gcp_organizations_getproject.project.project_id}/locations/us-central1/clusters/${gcp_managedkafka_cluster.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.cluster.cluster_id}.us-central1.managedkafka.${data.gcp_organizations_getproject.project.project_id}.cloud.goog"]
      }]
    }
  }
  labels = {
    "key" = "value"
  }
}
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 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")
            .ipCidrRange("10.3.0.0/16")
            .region("us-central1")
            .network("default")
            .build());

        var cluster = new Cluster("cluster", 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 example = new ConnectCluster("example", ConnectClusterArgs.builder()
            .connectClusterId("my-connect-cluster")
            .kafkaCluster(cluster.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(cluster.clusterId().applyValue(_clusterId -> String.format("%s.us-central1.managedkafka.%s.cloud.goog", _clusterId,project.projectId())))
                        .build())
                    .build())
                .build())
            .labels(Map.of("key", "value"))
            .build());

    }
}
resources:
  mkcSecondarySubnet:
    type: gcp:compute:Subnetwork
    name: mkc_secondary_subnet
    properties:
      project: ${project.projectId}
      name: my-secondary-subnetwork
      ipCidrRange: 10.3.0.0/16
      region: us-central1
      network: default
  cluster:
    type: gcp:managedkafka: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
  example:
    type: gcp:managedkafka:ConnectCluster
    properties:
      connectClusterId: my-connect-cluster
      kafkaCluster: projects/${project.projectId}/locations/us-central1/clusters/${cluster.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:
                - ${cluster.clusterId}.us-central1.managedkafka.${project.projectId}.cloud.goog
      labels:
        key: value
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

Import

ConnectCluster can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster_id}}
  • {{project}}/{{location}}/{{connect_cluster_id}}
  • {{location}}/{{connect_cluster_id}}

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

$ pulumi import gcp:managedkafka/connectCluster:ConnectCluster default projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster_id}}
$ pulumi import gcp:managedkafka/connectCluster:ConnectCluster default {{project}}/{{location}}/{{connect_cluster_id}}
$ pulumi import gcp:managedkafka/connectCluster:ConnectCluster default {{location}}/{{connect_cluster_id}}

Constructors

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

Properties

capacityConfig ↔ Output<ConnectClusterCapacityConfig>
A capacity configuration of a Kafka cluster. Structure is documented below.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
connectClusterId ↔ Output<String>
The ID to use for the Connect Cluster, which will become the final component of the connect cluster's name. This value is structured like: my-connect-cluster-id.
latefinal
createTime ↔ Output<String>
The time when the cluster was created.
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
effectiveLabels ↔ Output<Map<String, String>>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
gcpConfig ↔ Output<ConnectClusterGcpConfig>
Configuration properties for a Kafka Connect cluster deployed to Google Cloud Platform. Structure is documented below.
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
kafkaCluster ↔ Output<String>
The name of the Kafka cluster this Kafka Connect cluster is attached to. Structured like: projects/PROJECT_ID/locations/LOCATION/clusters/CLUSTER_ID.
latefinal
labels ↔ Output<Map<String, String>?>
List of label KEY=VALUE pairs to add. Keys must start with a lowercase character and contain only hyphens (-), underscores ( ), lowercase characters, and numbers. Values must contain only hyphens (-), underscores ( ), lowercase characters, and numbers. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effectiveLabels for all of the labels present on the resource.
latefinal
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 connect cluster. Structured like: projects/PROJECT_ID/locations/LOCATION/connectClusters/CONNECT_CLUSTER_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
pulumiLabels ↔ Output<Map<String, String>>
The combination of labels configured directly on the resource and default labels configured on the provider.
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 cluster. Possible values: STATE_UNSPECIFIED, CREATING, ACTIVE, DELETING.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
updateTime ↔ Output<String>
The time when the cluster was last updated.
latefinal
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, {ConnectClusterState? state, CustomResourceOptions? options}) → ConnectCluster
Gets an existing ConnectCluster resource's state with the given name and id.