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.
- Service
Name string Service to link the kafka topic to
- Topic
Name 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 string cleanup.policy value, can be
create
,delete
orcompact,delete
- Config
Kafka
Topic Config Args Kafka topic configuration
- Minimum
In intSync Replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- Retention
Bytes int retention.bytes value
- Retention
Hours int Retention period in hours, if -1 it is infinite.
- 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.
- 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.
- Service
Name string Service to link the kafka topic to
- Topic
Name 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 string cleanup.policy value, can be
create
,delete
orcompact,delete
- Config
Kafka
Topic Config Kafka topic configuration
- Minimum
In intSync Replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- Retention
Bytes int retention.bytes value
- Retention
Hours int Retention period in hours, if -1 it is infinite.
- 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.
- 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.
- service
Name string Service to link the kafka topic to
- topic
Name 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 string cleanup.policy value, can be
create
,delete
orcompact,delete
- config
Kafka
Topic Config Kafka topic configuration
- minimum
In numberSync Replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- retention
Bytes number retention.bytes value
- retention
Hours number Retention period in hours, if -1 it is infinite.
- termination
Protection 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
orcompact,delete
- config
Kafka
Topic Config Args Kafka topic configuration
- minimum_
in_ intsync_ replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- retention_
bytes int retention.bytes value
- retention_
hours int Retention period in hours, if -1 it is infinite.
- 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:
- Cleanup
Policy string cleanup.policy value, can be
create
,delete
orcompact,delete
- Config
Kafka
Topic Config Args Kafka topic configuration
- Minimum
In intSync Replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- 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.
- Retention
Bytes int retention.bytes value
- Retention
Hours int Retention period in hours, if -1 it is infinite.
- Service
Name string 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 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 string cleanup.policy value, can be
create
,delete
orcompact,delete
- Config
Kafka
Topic Config Kafka topic configuration
- Minimum
In intSync Replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- 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.
- Retention
Bytes int retention.bytes value
- Retention
Hours int Retention period in hours, if -1 it is infinite.
- Service
Name string 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 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 string cleanup.policy value, can be
create
,delete
orcompact,delete
- config
Kafka
Topic Config Kafka topic configuration
- minimum
In numberSync Replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- 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.
- retention
Bytes number retention.bytes value
- retention
Hours number Retention period in hours, if -1 it is infinite.
- service
Name string Service to link the kafka topic to
- termination
Protection 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.
- topic
Name 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
orcompact,delete
- config
Kafka
Topic Config Args Kafka topic configuration
- minimum_
in_ intsync_ replicas Minimum required nodes in-sync replicas (ISR) to produce to a partition.
- 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
- retention_
hours int Retention period in hours, if -1 it is infinite.
- 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
- Cleanup
Policy string cleanup.policy value, can be
create
,delete
orcompact,delete
- Compression
Type string compression.type value
- Delete
Retention stringMs delete.retention.ms value
- File
Delete stringDelay Ms file.delete.delay.ms value
- Flush
Messages string flush.messages value
- Flush
Ms string flush.ms value
- Index
Interval stringBytes index.interval.bytes value
- Max
Compaction stringLag Ms max.compaction.lag.ms value
- Max
Message stringBytes max.message.bytes value
- Message
Downconversion stringEnable message.downconversion.enable value
- Message
Format stringVersion message.format.version value
- Message
Timestamp stringDifference Max Ms message.timestamp.difference.max.ms value
- Message
Timestamp stringType message.timestamp.type value
- Min
Cleanable stringDirty Ratio min.cleanable.dirty.ratio value
- Min
Compaction stringLag Ms min.compaction.lag.ms value
- Min
Insync stringReplicas min.insync.replicas value
- Preallocate string
preallocate value
- Retention
Bytes string retention.bytes value
- Retention
Ms string retention.ms value
- Segment
Bytes string segment.bytes value
- Segment
Index stringBytes segment.index.bytes value
- Segment
Jitter stringMs segment.jitter.ms value
- Segment
Ms string segment.ms value
- Unclean
Leader stringElection Enable unclean.leader.election.enable value
- Cleanup
Policy string cleanup.policy value, can be
create
,delete
orcompact,delete
- Compression
Type string compression.type value
- Delete
Retention stringMs delete.retention.ms value
- File
Delete stringDelay Ms file.delete.delay.ms value
- Flush
Messages string flush.messages value
- Flush
Ms string flush.ms value
- Index
Interval stringBytes index.interval.bytes value
- Max
Compaction stringLag Ms max.compaction.lag.ms value
- Max
Message stringBytes max.message.bytes value
- Message
Downconversion stringEnable message.downconversion.enable value
- Message
Format stringVersion message.format.version value
- Message
Timestamp stringDifference Max Ms message.timestamp.difference.max.ms value
- Message
Timestamp stringType message.timestamp.type value
- Min
Cleanable stringDirty Ratio min.cleanable.dirty.ratio value
- Min
Compaction stringLag Ms min.compaction.lag.ms value
- Min
Insync stringReplicas min.insync.replicas value
- Preallocate string
preallocate value
- Retention
Bytes string retention.bytes value
- Retention
Ms string retention.ms value
- Segment
Bytes string segment.bytes value
- Segment
Index stringBytes segment.index.bytes value
- Segment
Jitter stringMs segment.jitter.ms value
- Segment
Ms string segment.ms value
- Unclean
Leader stringElection Enable unclean.leader.election.enable value
- cleanup
Policy string cleanup.policy value, can be
create
,delete
orcompact,delete
- compression
Type string compression.type value
- delete
Retention stringMs delete.retention.ms value
- file
Delete stringDelay Ms file.delete.delay.ms value
- flush
Messages string flush.messages value
- flush
Ms string flush.ms value
- index
Interval stringBytes index.interval.bytes value
- max
Compaction stringLag Ms max.compaction.lag.ms value
- max
Message stringBytes max.message.bytes value
- message
Downconversion stringEnable message.downconversion.enable value
- message
Format stringVersion message.format.version value
- message
Timestamp stringDifference Max Ms message.timestamp.difference.max.ms value
- message
Timestamp stringType message.timestamp.type value
- min
Cleanable stringDirty Ratio min.cleanable.dirty.ratio value
- min
Compaction stringLag Ms min.compaction.lag.ms value
- min
Insync stringReplicas min.insync.replicas value
- preallocate string
preallocate value
- retention
Bytes string retention.bytes value
- retention
Ms string retention.ms value
- segment
Bytes string segment.bytes value
- segment
Index stringBytes segment.index.bytes value
- segment
Jitter stringMs segment.jitter.ms value
- segment
Ms string segment.ms value
- unclean
Leader stringElection Enable unclean.leader.election.enable value
- cleanup_
policy str cleanup.policy value, can be
create
,delete
orcompact,delete
- compression_
type str compression.type value
- delete_
retention_ strms delete.retention.ms value
- file_
delete_ strdelay_ ms file.delete.delay.ms value
- flush_
messages str flush.messages value
- flush_
ms str flush.ms value
- index_
interval_ strbytes index.interval.bytes value
- max_
compaction_ strlag_ ms max.compaction.lag.ms value
- max_
message_ strbytes max.message.bytes value
- message_
downconversion_ strenable message.downconversion.enable value
- message_
format_ strversion message.format.version value
- message_
timestamp_ strdifference_ max_ ms message.timestamp.difference.max.ms value
- message_
timestamp_ strtype message.timestamp.type value
- min_
cleanable_ strdirty_ ratio min.cleanable.dirty.ratio value
- min_
compaction_ strlag_ ms min.compaction.lag.ms value
- min_
insync_ strreplicas 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_ strbytes segment.index.bytes value
- segment_
jitter_ strms segment.jitter.ms value
- segment_
ms str segment.ms value
- unclean_
leader_ strelection_ enable 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.