Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

KafkaTopic

# Kafka Topic Resource

The Kafka Topic resource allows the creation and management of Aiven Kafka Topics.

Example Usage

using Pulumi;
using Aiven = Pulumi.Aiven;

class MyStack : Stack
{
    public MyStack()
    {
        var mytesttopic = new Aiven.KafkaTopic("mytesttopic", new Aiven.KafkaTopicArgs
        {
            Config = new Aiven.Inputs.KafkaTopicConfigArgs
            {
                CleanupPolicy = "compact,delete",
                FlushMs = "10",
                UncleanLeaderElectionEnable = "true",
            },
            Partitions = 5,
            Project = aiven_project.Myproject.Project,
            Replication = 3,
            ServiceName = aiven_service.Myservice.Service_name,
            TerminationProtection = true,
            TopicName = "<TOPIC_NAME>",
        });
    }

}
package main

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

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := aiven.NewKafkaTopic(ctx, "mytesttopic", &aiven.KafkaTopicArgs{
            Config: &aiven.KafkaTopicConfigArgs{
                CleanupPolicy:               pulumi.String("compact,delete"),
                FlushMs:                     pulumi.String("10"),
                UncleanLeaderElectionEnable: pulumi.String("true"),
            },
            Partitions:            pulumi.Int(5),
            Project:               pulumi.Any(aiven_project.Myproject.Project),
            Replication:           pulumi.Int(3),
            ServiceName:           pulumi.Any(aiven_service.Myservice.Service_name),
            TerminationProtection: pulumi.Bool(true),
            TopicName:             pulumi.String("<TOPIC_NAME>"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aiven as aiven

mytesttopic = aiven.KafkaTopic("mytesttopic",
    config=aiven.KafkaTopicConfigArgs(
        cleanup_policy="compact,delete",
        flush_ms="10",
        unclean_leader_election_enable="true",
    ),
    partitions=5,
    project=aiven_project["myproject"]["project"],
    replication=3,
    service_name=aiven_service["myservice"]["service_name"],
    termination_protection=True,
    topic_name="<TOPIC_NAME>")
import * as pulumi from "@pulumi/pulumi";
import * as aiven from "@pulumi/aiven";

const mytesttopic = new aiven.KafkaTopic("mytesttopic", {
    config: {
        cleanupPolicy: "compact,delete",
        flushMs: "10",
        uncleanLeaderElectionEnable: "true",
    },
    partitions: 5,
    project: aiven_project_myproject.project,
    replication: 3,
    serviceName: aiven_service_myservice.serviceName,
    terminationProtection: true,
    topicName: "<TOPIC_NAME>",
}, { timeouts: {
    create: "1m",
    read: "5m",
} });

Create a KafkaTopic Resource

new KafkaTopic(name: string, args: KafkaTopicArgs, opts?: CustomResourceOptions);
def KafkaTopic(resource_name: str, opts: Optional[ResourceOptions] = None, cleanup_policy: Optional[str] = None, config: Optional[KafkaTopicConfigArgs] = None, minimum_in_sync_replicas: Optional[int] = None, partitions: Optional[int] = None, project: Optional[str] = None, replication: Optional[int] = None, retention_bytes: Optional[int] = None, retention_hours: Optional[int] = None, service_name: Optional[str] = None, termination_protection: Optional[bool] = None, topic_name: Optional[str] = None)
func NewKafkaTopic(ctx *Context, name string, args KafkaTopicArgs, opts ...ResourceOption) (*KafkaTopic, error)
public KafkaTopic(string name, KafkaTopicArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args KafkaTopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args KafkaTopicArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args KafkaTopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

KafkaTopic Resource Properties

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

Inputs

The KafkaTopic resource accepts the following input properties:

Partitions int

Number of partitions to create in the topic.

Project string

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

Replication int

Replication factor for the topic.

ServiceName string

Service to link the kafka topic to

TopicName string

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

CleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

Config KafkaTopicConfigArgs

Kafka topic configuration

MinimumInSyncReplicas int

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

RetentionBytes int

retention.bytes value

Deprecated: use config.retention_bytes instead

RetentionHours int

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

TerminationProtection bool

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

Partitions int

Number of partitions to create in the topic.

Project string

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

Replication int

Replication factor for the topic.

ServiceName string

Service to link the kafka topic to

TopicName string

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

CleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

Config KafkaTopicConfig

Kafka topic configuration

MinimumInSyncReplicas int

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

RetentionBytes int

retention.bytes value

Deprecated: use config.retention_bytes instead

RetentionHours int

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

TerminationProtection bool

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

partitions number

Number of partitions to create in the topic.

project string

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

replication number

Replication factor for the topic.

serviceName string

Service to link the kafka topic to

topicName string

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

cleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

config KafkaTopicConfig

Kafka topic configuration

minimumInSyncReplicas number

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

retentionBytes number

retention.bytes value

Deprecated: use config.retention_bytes instead

retentionHours number

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

terminationProtection boolean

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

partitions int

Number of partitions to create in the topic.

project str

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

replication int

Replication factor for the topic.

service_name str

Service to link the kafka topic to

topic_name str

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

cleanup_policy str

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

config KafkaTopicConfigArgs

Kafka topic configuration

minimum_in_sync_replicas int

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

retention_bytes int

retention.bytes value

Deprecated: use config.retention_bytes instead

retention_hours int

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

termination_protection bool

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing KafkaTopic Resource

Get an existing KafkaTopic 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?: KafkaTopicState, opts?: CustomResourceOptions): KafkaTopic
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, cleanup_policy: Optional[str] = None, config: Optional[KafkaTopicConfigArgs] = None, minimum_in_sync_replicas: Optional[int] = None, partitions: Optional[int] = None, project: Optional[str] = None, replication: Optional[int] = None, retention_bytes: Optional[int] = None, retention_hours: Optional[int] = None, service_name: Optional[str] = None, termination_protection: Optional[bool] = None, topic_name: Optional[str] = None) -> KafkaTopic
func GetKafkaTopic(ctx *Context, name string, id IDInput, state *KafkaTopicState, opts ...ResourceOption) (*KafkaTopic, error)
public static KafkaTopic Get(string name, Input<string> id, KafkaTopicState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:

CleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

Config KafkaTopicConfigArgs

Kafka topic configuration

MinimumInSyncReplicas int

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

Partitions int

Number of partitions to create in the topic.

Project string

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

Replication int

Replication factor for the topic.

RetentionBytes int

retention.bytes value

Deprecated: use config.retention_bytes instead

RetentionHours int

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

ServiceName string

Service to link the kafka topic to

TerminationProtection bool

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

TopicName string

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

CleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

Config KafkaTopicConfig

Kafka topic configuration

MinimumInSyncReplicas int

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

Partitions int

Number of partitions to create in the topic.

Project string

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

Replication int

Replication factor for the topic.

RetentionBytes int

retention.bytes value

Deprecated: use config.retention_bytes instead

RetentionHours int

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

ServiceName string

Service to link the kafka topic to

TerminationProtection bool

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

TopicName string

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

cleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

config KafkaTopicConfig

Kafka topic configuration

minimumInSyncReplicas number

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

partitions number

Number of partitions to create in the topic.

project string

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

replication number

Replication factor for the topic.

retentionBytes number

retention.bytes value

Deprecated: use config.retention_bytes instead

retentionHours number

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

serviceName string

Service to link the kafka topic to

terminationProtection boolean

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

topicName string

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

cleanup_policy str

cleanup.policy value, can be create, delete or compact,delete

Deprecated: use config.cleanup_policy instead

config KafkaTopicConfigArgs

Kafka topic configuration

minimum_in_sync_replicas int

Minimum required nodes in-sync replicas (ISR) to produce to a partition.

Deprecated: use config.min_insync_replicas instead

partitions int

Number of partitions to create in the topic.

project str

and service_name - (Required) define the project and service the topic belongs to. They should be defined using reference as shown above to set up dependencies correctly. These properties cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

replication int

Replication factor for the topic.

retention_bytes int

retention.bytes value

Deprecated: use config.retention_bytes instead

retention_hours int

Retention period in hours, if -1 it is infinite.

Deprecated: use config.retention_ms instead

service_name str

Service to link the kafka topic to

termination_protection bool

It is a Terraform client-side deletion protection, which prevents a Kafka topic from being deleted. It is recommended to enable this for any production Kafka topic containing critical data.

topic_name str

is the actual name of the topic account. This propery cannot be changed once the service is created. Doing so will result in the topic being deleted and new one created instead.

Supporting Types

KafkaTopicConfig

CleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

CompressionType string

compression.type value

DeleteRetentionMs string

delete.retention.ms value

FileDeleteDelayMs string

file.delete.delay.ms value

FlushMessages string

flush.messages value

FlushMs string

flush.ms value

IndexIntervalBytes string

index.interval.bytes value

MaxCompactionLagMs string

max.compaction.lag.ms value

MaxMessageBytes string

max.message.bytes value

MessageDownconversionEnable string

message.downconversion.enable value

MessageFormatVersion string

message.format.version value

MessageTimestampDifferenceMaxMs string

message.timestamp.difference.max.ms value

MessageTimestampType string

message.timestamp.type value

MinCleanableDirtyRatio string

min.cleanable.dirty.ratio value

MinCompactionLagMs string

min.compaction.lag.ms value

MinInsyncReplicas string

min.insync.replicas value

Preallocate string

preallocate value

RetentionBytes string

retention.bytes value

RetentionMs string

retention.ms value

SegmentBytes string

segment.bytes value

SegmentIndexBytes string

segment.index.bytes value

SegmentJitterMs string

segment.jitter.ms value

SegmentMs string

segment.ms value

UncleanLeaderElectionEnable string

unclean.leader.election.enable value

CleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

CompressionType string

compression.type value

DeleteRetentionMs string

delete.retention.ms value

FileDeleteDelayMs string

file.delete.delay.ms value

FlushMessages string

flush.messages value

FlushMs string

flush.ms value

IndexIntervalBytes string

index.interval.bytes value

MaxCompactionLagMs string

max.compaction.lag.ms value

MaxMessageBytes string

max.message.bytes value

MessageDownconversionEnable string

message.downconversion.enable value

MessageFormatVersion string

message.format.version value

MessageTimestampDifferenceMaxMs string

message.timestamp.difference.max.ms value

MessageTimestampType string

message.timestamp.type value

MinCleanableDirtyRatio string

min.cleanable.dirty.ratio value

MinCompactionLagMs string

min.compaction.lag.ms value

MinInsyncReplicas string

min.insync.replicas value

Preallocate string

preallocate value

RetentionBytes string

retention.bytes value

RetentionMs string

retention.ms value

SegmentBytes string

segment.bytes value

SegmentIndexBytes string

segment.index.bytes value

SegmentJitterMs string

segment.jitter.ms value

SegmentMs string

segment.ms value

UncleanLeaderElectionEnable string

unclean.leader.election.enable value

cleanupPolicy string

cleanup.policy value, can be create, delete or compact,delete

compressionType string

compression.type value

deleteRetentionMs string

delete.retention.ms value

fileDeleteDelayMs string

file.delete.delay.ms value

flushMessages string

flush.messages value

flushMs string

flush.ms value

indexIntervalBytes string

index.interval.bytes value

maxCompactionLagMs string

max.compaction.lag.ms value

maxMessageBytes string

max.message.bytes value

messageDownconversionEnable string

message.downconversion.enable value

messageFormatVersion string

message.format.version value

messageTimestampDifferenceMaxMs string

message.timestamp.difference.max.ms value

messageTimestampType string

message.timestamp.type value

minCleanableDirtyRatio string

min.cleanable.dirty.ratio value

minCompactionLagMs string

min.compaction.lag.ms value

minInsyncReplicas string

min.insync.replicas value

preallocate string

preallocate value

retentionBytes string

retention.bytes value

retentionMs string

retention.ms value

segmentBytes string

segment.bytes value

segmentIndexBytes string

segment.index.bytes value

segmentJitterMs string

segment.jitter.ms value

segmentMs string

segment.ms value

uncleanLeaderElectionEnable string

unclean.leader.election.enable value

cleanup_policy str

cleanup.policy value, can be create, delete or compact,delete

compression_type str

compression.type value

delete_retention_ms str

delete.retention.ms value

file_delete_delay_ms str

file.delete.delay.ms value

flush_messages str

flush.messages value

flush_ms str

flush.ms value

index_interval_bytes str

index.interval.bytes value

max_compaction_lag_ms str

max.compaction.lag.ms value

max_message_bytes str

max.message.bytes value

message_downconversion_enable str

message.downconversion.enable value

message_format_version str

message.format.version value

message_timestamp_difference_max_ms str

message.timestamp.difference.max.ms value

message_timestamp_type str

message.timestamp.type value

min_cleanable_dirty_ratio str

min.cleanable.dirty.ratio value

min_compaction_lag_ms str

min.compaction.lag.ms value

min_insync_replicas str

min.insync.replicas value

preallocate str

preallocate value

retention_bytes str

retention.bytes value

retention_ms str

retention.ms value

segment_bytes str

segment.bytes value

segment_index_bytes str

segment.index.bytes value

segment_jitter_ms str

segment.jitter.ms value

segment_ms str

segment.ms value

unclean_leader_election_enable str

unclean.leader.election.enable value

Package Details

Repository
https://github.com/pulumi/pulumi-aiven
License
Apache-2.0
Notes
This Pulumi package is based on the aiven Terraform Provider.