1. Packages
  2. Volcengine
  3. API Docs
  4. kafka
  5. Topic
Volcengine v0.0.27 published on Tuesday, Dec 10, 2024 by Volcengine

volcengine.kafka.Topic

Explore with Pulumi AI

Provides a resource to manage kafka topic

Example Usage

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

const fooZones = volcengine.ecs.Zones({});
const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
    vpcName: "acc-test-vpc",
    cidrBlock: "172.16.0.0/16",
});
const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
    subnetName: "acc-test-subnet",
    cidrBlock: "172.16.0.0/24",
    zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
    vpcId: fooVpc.id,
});
const fooInstance = new volcengine.kafka.Instance("fooInstance", {
    instanceName: "acc-test-kafka",
    instanceDescription: "tf-test",
    version: "2.2.2",
    computeSpec: "kafka.20xrate.hw",
    subnetId: fooSubnet.id,
    userName: "tf-user",
    userPassword: "tf-pass!@q1",
    chargeType: "PostPaid",
    storageSpace: 300,
    partitionNumber: 350,
    projectName: "default",
    tags: [{
        key: "k1",
        value: "v1",
    }],
    parameters: [
        {
            parameterName: "MessageMaxByte",
            parameterValue: "12",
        },
        {
            parameterName: "LogRetentionHours",
            parameterValue: "70",
        },
    ],
});
const fooSaslUser = new volcengine.kafka.SaslUser("fooSaslUser", {
    userName: "acc-test-user",
    instanceId: fooInstance.id,
    userPassword: "suqsnis123!",
    description: "tf-test",
    allAuthority: true,
    passwordType: "Scram",
});
const fooTopic = new volcengine.kafka.Topic("fooTopic", {
    topicName: "acc-test-topic",
    instanceId: fooInstance.id,
    description: "tf-test",
    partitionNumber: 15,
    replicaNumber: 3,
    parameters: {
        minInsyncReplicaNumber: 2,
        messageMaxByte: 10,
        logRetentionHours: 96,
    },
    allAuthority: false,
    accessPolicies: [{
        userName: fooSaslUser.userName,
        accessPolicy: "Pub",
    }],
});
Copy
import pulumi
import pulumi_volcengine as volcengine

foo_zones = volcengine.ecs.zones()
foo_vpc = volcengine.vpc.Vpc("fooVpc",
    vpc_name="acc-test-vpc",
    cidr_block="172.16.0.0/16")
foo_subnet = volcengine.vpc.Subnet("fooSubnet",
    subnet_name="acc-test-subnet",
    cidr_block="172.16.0.0/24",
    zone_id=foo_zones.zones[0].id,
    vpc_id=foo_vpc.id)
foo_instance = volcengine.kafka.Instance("fooInstance",
    instance_name="acc-test-kafka",
    instance_description="tf-test",
    version="2.2.2",
    compute_spec="kafka.20xrate.hw",
    subnet_id=foo_subnet.id,
    user_name="tf-user",
    user_password="tf-pass!@q1",
    charge_type="PostPaid",
    storage_space=300,
    partition_number=350,
    project_name="default",
    tags=[volcengine.kafka.InstanceTagArgs(
        key="k1",
        value="v1",
    )],
    parameters=[
        volcengine.kafka.InstanceParameterArgs(
            parameter_name="MessageMaxByte",
            parameter_value="12",
        ),
        volcengine.kafka.InstanceParameterArgs(
            parameter_name="LogRetentionHours",
            parameter_value="70",
        ),
    ])
foo_sasl_user = volcengine.kafka.SaslUser("fooSaslUser",
    user_name="acc-test-user",
    instance_id=foo_instance.id,
    user_password="suqsnis123!",
    description="tf-test",
    all_authority=True,
    password_type="Scram")
foo_topic = volcengine.kafka.Topic("fooTopic",
    topic_name="acc-test-topic",
    instance_id=foo_instance.id,
    description="tf-test",
    partition_number=15,
    replica_number=3,
    parameters=volcengine.kafka.TopicParametersArgs(
        min_insync_replica_number=2,
        message_max_byte=10,
        log_retention_hours=96,
    ),
    all_authority=False,
    access_policies=[volcengine.kafka.TopicAccessPolicyArgs(
        user_name=foo_sasl_user.user_name,
        access_policy="Pub",
    )])
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/kafka"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		fooZones, err := ecs.Zones(ctx, nil, nil)
		if err != nil {
			return err
		}
		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
			VpcName:   pulumi.String("acc-test-vpc"),
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
			SubnetName: pulumi.String("acc-test-subnet"),
			CidrBlock:  pulumi.String("172.16.0.0/24"),
			ZoneId:     pulumi.String(fooZones.Zones[0].Id),
			VpcId:      fooVpc.ID(),
		})
		if err != nil {
			return err
		}
		fooInstance, err := kafka.NewInstance(ctx, "fooInstance", &kafka.InstanceArgs{
			InstanceName:        pulumi.String("acc-test-kafka"),
			InstanceDescription: pulumi.String("tf-test"),
			Version:             pulumi.String("2.2.2"),
			ComputeSpec:         pulumi.String("kafka.20xrate.hw"),
			SubnetId:            fooSubnet.ID(),
			UserName:            pulumi.String("tf-user"),
			UserPassword:        pulumi.String("tf-pass!@q1"),
			ChargeType:          pulumi.String("PostPaid"),
			StorageSpace:        pulumi.Int(300),
			PartitionNumber:     pulumi.Int(350),
			ProjectName:         pulumi.String("default"),
			Tags: kafka.InstanceTagArray{
				&kafka.InstanceTagArgs{
					Key:   pulumi.String("k1"),
					Value: pulumi.String("v1"),
				},
			},
			Parameters: kafka.InstanceParameterArray{
				&kafka.InstanceParameterArgs{
					ParameterName:  pulumi.String("MessageMaxByte"),
					ParameterValue: pulumi.String("12"),
				},
				&kafka.InstanceParameterArgs{
					ParameterName:  pulumi.String("LogRetentionHours"),
					ParameterValue: pulumi.String("70"),
				},
			},
		})
		if err != nil {
			return err
		}
		fooSaslUser, err := kafka.NewSaslUser(ctx, "fooSaslUser", &kafka.SaslUserArgs{
			UserName:     pulumi.String("acc-test-user"),
			InstanceId:   fooInstance.ID(),
			UserPassword: pulumi.String("suqsnis123!"),
			Description:  pulumi.String("tf-test"),
			AllAuthority: pulumi.Bool(true),
			PasswordType: pulumi.String("Scram"),
		})
		if err != nil {
			return err
		}
		_, err = kafka.NewTopic(ctx, "fooTopic", &kafka.TopicArgs{
			TopicName:       pulumi.String("acc-test-topic"),
			InstanceId:      fooInstance.ID(),
			Description:     pulumi.String("tf-test"),
			PartitionNumber: pulumi.Int(15),
			ReplicaNumber:   pulumi.Int(3),
			Parameters: &kafka.TopicParametersArgs{
				MinInsyncReplicaNumber: pulumi.Int(2),
				MessageMaxByte:         pulumi.Int(10),
				LogRetentionHours:      pulumi.Int(96),
			},
			AllAuthority: pulumi.Bool(false),
			AccessPolicies: kafka.TopicAccessPolicyArray{
				&kafka.TopicAccessPolicyArgs{
					UserName:     fooSaslUser.UserName,
					AccessPolicy: pulumi.String("Pub"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;

return await Deployment.RunAsync(() => 
{
    var fooZones = Volcengine.Ecs.Zones.Invoke();

    var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
    {
        VpcName = "acc-test-vpc",
        CidrBlock = "172.16.0.0/16",
    });

    var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
    {
        SubnetName = "acc-test-subnet",
        CidrBlock = "172.16.0.0/24",
        ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
        VpcId = fooVpc.Id,
    });

    var fooInstance = new Volcengine.Kafka.Instance("fooInstance", new()
    {
        InstanceName = "acc-test-kafka",
        InstanceDescription = "tf-test",
        Version = "2.2.2",
        ComputeSpec = "kafka.20xrate.hw",
        SubnetId = fooSubnet.Id,
        UserName = "tf-user",
        UserPassword = "tf-pass!@q1",
        ChargeType = "PostPaid",
        StorageSpace = 300,
        PartitionNumber = 350,
        ProjectName = "default",
        Tags = new[]
        {
            new Volcengine.Kafka.Inputs.InstanceTagArgs
            {
                Key = "k1",
                Value = "v1",
            },
        },
        Parameters = new[]
        {
            new Volcengine.Kafka.Inputs.InstanceParameterArgs
            {
                ParameterName = "MessageMaxByte",
                ParameterValue = "12",
            },
            new Volcengine.Kafka.Inputs.InstanceParameterArgs
            {
                ParameterName = "LogRetentionHours",
                ParameterValue = "70",
            },
        },
    });

    var fooSaslUser = new Volcengine.Kafka.SaslUser("fooSaslUser", new()
    {
        UserName = "acc-test-user",
        InstanceId = fooInstance.Id,
        UserPassword = "suqsnis123!",
        Description = "tf-test",
        AllAuthority = true,
        PasswordType = "Scram",
    });

    var fooTopic = new Volcengine.Kafka.Topic("fooTopic", new()
    {
        TopicName = "acc-test-topic",
        InstanceId = fooInstance.Id,
        Description = "tf-test",
        PartitionNumber = 15,
        ReplicaNumber = 3,
        Parameters = new Volcengine.Kafka.Inputs.TopicParametersArgs
        {
            MinInsyncReplicaNumber = 2,
            MessageMaxByte = 10,
            LogRetentionHours = 96,
        },
        AllAuthority = false,
        AccessPolicies = new[]
        {
            new Volcengine.Kafka.Inputs.TopicAccessPolicyArgs
            {
                UserName = fooSaslUser.UserName,
                AccessPolicy = "Pub",
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
import com.pulumi.volcengine.vpc.Vpc;
import com.pulumi.volcengine.vpc.VpcArgs;
import com.pulumi.volcengine.vpc.Subnet;
import com.pulumi.volcengine.vpc.SubnetArgs;
import com.pulumi.volcengine.kafka.Instance;
import com.pulumi.volcengine.kafka.InstanceArgs;
import com.pulumi.volcengine.kafka.inputs.InstanceTagArgs;
import com.pulumi.volcengine.kafka.inputs.InstanceParameterArgs;
import com.pulumi.volcengine.kafka.SaslUser;
import com.pulumi.volcengine.kafka.SaslUserArgs;
import com.pulumi.volcengine.kafka.Topic;
import com.pulumi.volcengine.kafka.TopicArgs;
import com.pulumi.volcengine.kafka.inputs.TopicParametersArgs;
import com.pulumi.volcengine.kafka.inputs.TopicAccessPolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 fooZones = EcsFunctions.Zones();

        var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
            .vpcName("acc-test-vpc")
            .cidrBlock("172.16.0.0/16")
            .build());

        var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
            .subnetName("acc-test-subnet")
            .cidrBlock("172.16.0.0/24")
            .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .vpcId(fooVpc.id())
            .build());

        var fooInstance = new Instance("fooInstance", InstanceArgs.builder()        
            .instanceName("acc-test-kafka")
            .instanceDescription("tf-test")
            .version("2.2.2")
            .computeSpec("kafka.20xrate.hw")
            .subnetId(fooSubnet.id())
            .userName("tf-user")
            .userPassword("tf-pass!@q1")
            .chargeType("PostPaid")
            .storageSpace(300)
            .partitionNumber(350)
            .projectName("default")
            .tags(InstanceTagArgs.builder()
                .key("k1")
                .value("v1")
                .build())
            .parameters(            
                InstanceParameterArgs.builder()
                    .parameterName("MessageMaxByte")
                    .parameterValue("12")
                    .build(),
                InstanceParameterArgs.builder()
                    .parameterName("LogRetentionHours")
                    .parameterValue("70")
                    .build())
            .build());

        var fooSaslUser = new SaslUser("fooSaslUser", SaslUserArgs.builder()        
            .userName("acc-test-user")
            .instanceId(fooInstance.id())
            .userPassword("suqsnis123!")
            .description("tf-test")
            .allAuthority(true)
            .passwordType("Scram")
            .build());

        var fooTopic = new Topic("fooTopic", TopicArgs.builder()        
            .topicName("acc-test-topic")
            .instanceId(fooInstance.id())
            .description("tf-test")
            .partitionNumber(15)
            .replicaNumber(3)
            .parameters(TopicParametersArgs.builder()
                .minInsyncReplicaNumber(2)
                .messageMaxByte(10)
                .logRetentionHours(96)
                .build())
            .allAuthority(false)
            .accessPolicies(TopicAccessPolicyArgs.builder()
                .userName(fooSaslUser.userName())
                .accessPolicy("Pub")
                .build())
            .build());

    }
}
Copy
resources:
  fooVpc:
    type: volcengine:vpc:Vpc
    properties:
      vpcName: acc-test-vpc
      cidrBlock: 172.16.0.0/16
  fooSubnet:
    type: volcengine:vpc:Subnet
    properties:
      subnetName: acc-test-subnet
      cidrBlock: 172.16.0.0/24
      zoneId: ${fooZones.zones[0].id}
      vpcId: ${fooVpc.id}
  fooInstance:
    type: volcengine:kafka:Instance
    properties:
      instanceName: acc-test-kafka
      instanceDescription: tf-test
      version: 2.2.2
      computeSpec: kafka.20xrate.hw
      subnetId: ${fooSubnet.id}
      userName: tf-user
      userPassword: tf-pass!@q1
      chargeType: PostPaid
      storageSpace: 300
      partitionNumber: 350
      projectName: default
      tags:
        - key: k1
          value: v1
      parameters:
        - parameterName: MessageMaxByte
          parameterValue: '12'
        - parameterName: LogRetentionHours
          parameterValue: '70'
  fooSaslUser:
    type: volcengine:kafka:SaslUser
    properties:
      userName: acc-test-user
      instanceId: ${fooInstance.id}
      userPassword: suqsnis123!
      description: tf-test
      allAuthority: true
      passwordType: Scram
  fooTopic:
    type: volcengine:kafka:Topic
    properties:
      topicName: acc-test-topic
      instanceId: ${fooInstance.id}
      description: tf-test
      partitionNumber: 15
      replicaNumber: 3
      parameters:
        minInsyncReplicaNumber: 2
        messageMaxByte: 10
        logRetentionHours: 96
      allAuthority: false
      accessPolicies:
        - userName: ${fooSaslUser.userName}
          accessPolicy: Pub
variables:
  fooZones:
    fn::invoke:
      Function: volcengine:ecs:Zones
      Arguments: {}
Copy

Create Topic Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Topic(name: string, args: TopicArgs, opts?: CustomResourceOptions);
@overload
def Topic(resource_name: str,
          args: TopicArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def Topic(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          instance_id: Optional[str] = None,
          partition_number: Optional[int] = None,
          topic_name: Optional[str] = None,
          access_policies: Optional[Sequence[TopicAccessPolicyArgs]] = None,
          all_authority: Optional[bool] = None,
          description: Optional[str] = None,
          parameters: Optional[TopicParametersArgs] = None,
          replica_number: Optional[int] = None)
func NewTopic(ctx *Context, name string, args TopicArgs, opts ...ResourceOption) (*Topic, error)
public Topic(string name, TopicArgs args, CustomResourceOptions? opts = null)
public Topic(String name, TopicArgs args)
public Topic(String name, TopicArgs args, CustomResourceOptions options)
type: volcengine:kafka:Topic
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. TopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. TopicArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. TopicArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. TopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TopicArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var topicResource = new Volcengine.Kafka.Topic("topicResource", new()
{
    InstanceId = "string",
    PartitionNumber = 0,
    TopicName = "string",
    AccessPolicies = new[]
    {
        new Volcengine.Kafka.Inputs.TopicAccessPolicyArgs
        {
            AccessPolicy = "string",
            UserName = "string",
        },
    },
    AllAuthority = false,
    Description = "string",
    Parameters = new Volcengine.Kafka.Inputs.TopicParametersArgs
    {
        LogRetentionHours = 0,
        MessageMaxByte = 0,
        MinInsyncReplicaNumber = 0,
    },
    ReplicaNumber = 0,
});
Copy
example, err := kafka.NewTopic(ctx, "topicResource", &kafka.TopicArgs{
	InstanceId:      pulumi.String("string"),
	PartitionNumber: pulumi.Int(0),
	TopicName:       pulumi.String("string"),
	AccessPolicies: kafka.TopicAccessPolicyArray{
		&kafka.TopicAccessPolicyArgs{
			AccessPolicy: pulumi.String("string"),
			UserName:     pulumi.String("string"),
		},
	},
	AllAuthority: pulumi.Bool(false),
	Description:  pulumi.String("string"),
	Parameters: &kafka.TopicParametersArgs{
		LogRetentionHours:      pulumi.Int(0),
		MessageMaxByte:         pulumi.Int(0),
		MinInsyncReplicaNumber: pulumi.Int(0),
	},
	ReplicaNumber: pulumi.Int(0),
})
Copy
var topicResource = new Topic("topicResource", TopicArgs.builder()
    .instanceId("string")
    .partitionNumber(0)
    .topicName("string")
    .accessPolicies(TopicAccessPolicyArgs.builder()
        .accessPolicy("string")
        .userName("string")
        .build())
    .allAuthority(false)
    .description("string")
    .parameters(TopicParametersArgs.builder()
        .logRetentionHours(0)
        .messageMaxByte(0)
        .minInsyncReplicaNumber(0)
        .build())
    .replicaNumber(0)
    .build());
Copy
topic_resource = volcengine.kafka.Topic("topicResource",
    instance_id="string",
    partition_number=0,
    topic_name="string",
    access_policies=[{
        "access_policy": "string",
        "user_name": "string",
    }],
    all_authority=False,
    description="string",
    parameters={
        "log_retention_hours": 0,
        "message_max_byte": 0,
        "min_insync_replica_number": 0,
    },
    replica_number=0)
Copy
const topicResource = new volcengine.kafka.Topic("topicResource", {
    instanceId: "string",
    partitionNumber: 0,
    topicName: "string",
    accessPolicies: [{
        accessPolicy: "string",
        userName: "string",
    }],
    allAuthority: false,
    description: "string",
    parameters: {
        logRetentionHours: 0,
        messageMaxByte: 0,
        minInsyncReplicaNumber: 0,
    },
    replicaNumber: 0,
});
Copy
type: volcengine:kafka:Topic
properties:
    accessPolicies:
        - accessPolicy: string
          userName: string
    allAuthority: false
    description: string
    instanceId: string
    parameters:
        logRetentionHours: 0
        messageMaxByte: 0
        minInsyncReplicaNumber: 0
    partitionNumber: 0
    replicaNumber: 0
    topicName: string
Copy

Topic Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Topic resource accepts the following input properties:

InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The instance id of the kafka topic.
PartitionNumber This property is required. int
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
TopicName
This property is required.
Changes to this property will trigger replacement.
string
The name of the kafka topic.
AccessPolicies List<TopicAccessPolicy>
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
AllAuthority bool
Whether the kafka topic is configured to be accessible by all users. Default: true.
Description string
The description of the kafka topic.
Parameters TopicParameters
The parameters of the kafka topic.
ReplicaNumber Changes to this property will trigger replacement. int
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The instance id of the kafka topic.
PartitionNumber This property is required. int
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
TopicName
This property is required.
Changes to this property will trigger replacement.
string
The name of the kafka topic.
AccessPolicies []TopicAccessPolicyArgs
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
AllAuthority bool
Whether the kafka topic is configured to be accessible by all users. Default: true.
Description string
The description of the kafka topic.
Parameters TopicParametersArgs
The parameters of the kafka topic.
ReplicaNumber Changes to this property will trigger replacement. int
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The instance id of the kafka topic.
partitionNumber This property is required. Integer
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
topicName
This property is required.
Changes to this property will trigger replacement.
String
The name of the kafka topic.
accessPolicies List<TopicAccessPolicy>
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
allAuthority Boolean
Whether the kafka topic is configured to be accessible by all users. Default: true.
description String
The description of the kafka topic.
parameters TopicParameters
The parameters of the kafka topic.
replicaNumber Changes to this property will trigger replacement. Integer
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
instanceId
This property is required.
Changes to this property will trigger replacement.
string
The instance id of the kafka topic.
partitionNumber This property is required. number
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
topicName
This property is required.
Changes to this property will trigger replacement.
string
The name of the kafka topic.
accessPolicies TopicAccessPolicy[]
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
allAuthority boolean
Whether the kafka topic is configured to be accessible by all users. Default: true.
description string
The description of the kafka topic.
parameters TopicParameters
The parameters of the kafka topic.
replicaNumber Changes to this property will trigger replacement. number
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
instance_id
This property is required.
Changes to this property will trigger replacement.
str
The instance id of the kafka topic.
partition_number This property is required. int
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
topic_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the kafka topic.
access_policies Sequence[TopicAccessPolicyArgs]
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
all_authority bool
Whether the kafka topic is configured to be accessible by all users. Default: true.
description str
The description of the kafka topic.
parameters TopicParametersArgs
The parameters of the kafka topic.
replica_number Changes to this property will trigger replacement. int
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The instance id of the kafka topic.
partitionNumber This property is required. Number
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
topicName
This property is required.
Changes to this property will trigger replacement.
String
The name of the kafka topic.
accessPolicies List<Property Map>
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
allAuthority Boolean
Whether the kafka topic is configured to be accessible by all users. Default: true.
description String
The description of the kafka topic.
parameters Property Map
The parameters of the kafka topic.
replicaNumber Changes to this property will trigger replacement. Number
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.

Outputs

All input properties are implicitly available as output properties. Additionally, the Topic 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 string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Topic Resource

Get an existing Topic 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?: TopicState, opts?: CustomResourceOptions): Topic
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_policies: Optional[Sequence[TopicAccessPolicyArgs]] = None,
        all_authority: Optional[bool] = None,
        description: Optional[str] = None,
        instance_id: Optional[str] = None,
        parameters: Optional[TopicParametersArgs] = None,
        partition_number: Optional[int] = None,
        replica_number: Optional[int] = None,
        topic_name: Optional[str] = None) -> Topic
func GetTopic(ctx *Context, name string, id IDInput, state *TopicState, opts ...ResourceOption) (*Topic, error)
public static Topic Get(string name, Input<string> id, TopicState? state, CustomResourceOptions? opts = null)
public static Topic get(String name, Output<String> id, TopicState state, CustomResourceOptions options)
resources:  _:    type: volcengine:kafka:Topic    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AccessPolicies List<TopicAccessPolicy>
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
AllAuthority bool
Whether the kafka topic is configured to be accessible by all users. Default: true.
Description string
The description of the kafka topic.
InstanceId Changes to this property will trigger replacement. string
The instance id of the kafka topic.
Parameters TopicParameters
The parameters of the kafka topic.
PartitionNumber int
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
ReplicaNumber Changes to this property will trigger replacement. int
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
TopicName Changes to this property will trigger replacement. string
The name of the kafka topic.
AccessPolicies []TopicAccessPolicyArgs
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
AllAuthority bool
Whether the kafka topic is configured to be accessible by all users. Default: true.
Description string
The description of the kafka topic.
InstanceId Changes to this property will trigger replacement. string
The instance id of the kafka topic.
Parameters TopicParametersArgs
The parameters of the kafka topic.
PartitionNumber int
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
ReplicaNumber Changes to this property will trigger replacement. int
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
TopicName Changes to this property will trigger replacement. string
The name of the kafka topic.
accessPolicies List<TopicAccessPolicy>
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
allAuthority Boolean
Whether the kafka topic is configured to be accessible by all users. Default: true.
description String
The description of the kafka topic.
instanceId Changes to this property will trigger replacement. String
The instance id of the kafka topic.
parameters TopicParameters
The parameters of the kafka topic.
partitionNumber Integer
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
replicaNumber Changes to this property will trigger replacement. Integer
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
topicName Changes to this property will trigger replacement. String
The name of the kafka topic.
accessPolicies TopicAccessPolicy[]
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
allAuthority boolean
Whether the kafka topic is configured to be accessible by all users. Default: true.
description string
The description of the kafka topic.
instanceId Changes to this property will trigger replacement. string
The instance id of the kafka topic.
parameters TopicParameters
The parameters of the kafka topic.
partitionNumber number
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
replicaNumber Changes to this property will trigger replacement. number
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
topicName Changes to this property will trigger replacement. string
The name of the kafka topic.
access_policies Sequence[TopicAccessPolicyArgs]
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
all_authority bool
Whether the kafka topic is configured to be accessible by all users. Default: true.
description str
The description of the kafka topic.
instance_id Changes to this property will trigger replacement. str
The instance id of the kafka topic.
parameters TopicParametersArgs
The parameters of the kafka topic.
partition_number int
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
replica_number Changes to this property will trigger replacement. int
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
topic_name Changes to this property will trigger replacement. str
The name of the kafka topic.
accessPolicies List<Property Map>
The access policies info of the kafka topic. This field only valid when the value of the AllAuthority is false.
allAuthority Boolean
Whether the kafka topic is configured to be accessible by all users. Default: true.
description String
The description of the kafka topic.
instanceId Changes to this property will trigger replacement. String
The instance id of the kafka topic.
parameters Property Map
The parameters of the kafka topic.
partitionNumber Number
The number of partition in kafka topic. The value range in 1-300. This field can only be adjusted up but not down.
replicaNumber Changes to this property will trigger replacement. Number
The number of replica in kafka topic. The value can be 2 or 3. Default is 3.
topicName Changes to this property will trigger replacement. String
The name of the kafka topic.

Supporting Types

TopicAccessPolicy
, TopicAccessPolicyArgs

AccessPolicy This property is required. string
The access policy of SASL user. Valid values: PubSub, Pub, Sub.
UserName This property is required. string
The name of SASL user.
AccessPolicy This property is required. string
The access policy of SASL user. Valid values: PubSub, Pub, Sub.
UserName This property is required. string
The name of SASL user.
accessPolicy This property is required. String
The access policy of SASL user. Valid values: PubSub, Pub, Sub.
userName This property is required. String
The name of SASL user.
accessPolicy This property is required. string
The access policy of SASL user. Valid values: PubSub, Pub, Sub.
userName This property is required. string
The name of SASL user.
access_policy This property is required. str
The access policy of SASL user. Valid values: PubSub, Pub, Sub.
user_name This property is required. str
The name of SASL user.
accessPolicy This property is required. String
The access policy of SASL user. Valid values: PubSub, Pub, Sub.
userName This property is required. String
The name of SASL user.

TopicParameters
, TopicParametersArgs

LogRetentionHours int
The retention hours of log. Unit: hour. Valid values: 0-2160. Default is 72.
MessageMaxByte int
The max byte of message. Unit: MB. Valid values: 1-12. Default is 10.
MinInsyncReplicaNumber int
The min number of sync replica. The default value is the replica number minus 1.
LogRetentionHours int
The retention hours of log. Unit: hour. Valid values: 0-2160. Default is 72.
MessageMaxByte int
The max byte of message. Unit: MB. Valid values: 1-12. Default is 10.
MinInsyncReplicaNumber int
The min number of sync replica. The default value is the replica number minus 1.
logRetentionHours Integer
The retention hours of log. Unit: hour. Valid values: 0-2160. Default is 72.
messageMaxByte Integer
The max byte of message. Unit: MB. Valid values: 1-12. Default is 10.
minInsyncReplicaNumber Integer
The min number of sync replica. The default value is the replica number minus 1.
logRetentionHours number
The retention hours of log. Unit: hour. Valid values: 0-2160. Default is 72.
messageMaxByte number
The max byte of message. Unit: MB. Valid values: 1-12. Default is 10.
minInsyncReplicaNumber number
The min number of sync replica. The default value is the replica number minus 1.
log_retention_hours int
The retention hours of log. Unit: hour. Valid values: 0-2160. Default is 72.
message_max_byte int
The max byte of message. Unit: MB. Valid values: 1-12. Default is 10.
min_insync_replica_number int
The min number of sync replica. The default value is the replica number minus 1.
logRetentionHours Number
The retention hours of log. Unit: hour. Valid values: 0-2160. Default is 72.
messageMaxByte Number
The max byte of message. Unit: MB. Valid values: 1-12. Default is 10.
minInsyncReplicaNumber Number
The min number of sync replica. The default value is the replica number minus 1.

Import

KafkaTopic can be imported using the instance_id:topic_name, e.g.

$ pulumi import volcengine:kafka/topic:Topic default kafka-cnoeeapetf4s****:topic
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
volcengine volcengine/pulumi-volcengine
License
Apache-2.0
Notes
This Pulumi package is based on the volcengine Terraform Provider.