Create a Kafka Cluster on Confluent Cloud from a Template Using Pulumi

What is Pulumi?

Pulumi is an open source infrastructure-as-code tool that utilizes the most popular programming languages to simplify provisioning and managing cloud resources.

Why Pulumi and Kafka?

The Confluent Cloud provider for Pulumi is built on the official Create a Kafka Cluster on Confluent Cloud from a Template Using Terraform and enables programming Confluent Cloud by using popular languages like TypeScript, JavaScript, Python, Go, .NET, Java, and YAML.

Using the Confluent Cloud provider for Pulumi

The following code example shows how to provision a Confluent Cloud environment and a Kafka cluster by using C#.

public void CreateEnvironment(
    string envName,
    string clusterName)
{
    EnvironmentArgs args = new()
    {
        DisplayName = envName
    };

    Pulumi.ConfluentCloud.Environment env = new(envName, args);

    KafkaClusterEnvironmentArgs clusterEnvArgs = new()
    {
        Id = env.Id
    };

    KafkaClusterArgs clusterArgs = new()
    {
        Availability = "SINGLE_ZONE",
        Basics = new KafkaClusterBasicArgs(),
        Cloud = "AWS",
        DisplayName = clusterName,
        Environment = clusterEnvArgs,
        Region = "us-west-2",
    };

    KafkaCluster cluster = new(clusterName, clusterArgs);
}