1. Packages
  2. Packages
  3. AWS
  4. API Docs
  5. msk
  6. getTopic
Viewing docs for AWS v7.28.0
published on Thursday, Apr 30, 2026 by Pulumi
aws logo
Viewing docs for AWS v7.28.0
published on Thursday, Apr 30, 2026 by Pulumi

    Get information on an Amazon MSK Topic.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.msk.getTopic({
        clusterArn: exampleAwsMskCluster.arn,
        name: "example",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.msk.get_topic(cluster_arn=example_aws_msk_cluster["arn"],
        name="example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/msk"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := msk.LookupTopic(ctx, &msk.LookupTopicArgs{
    			ClusterArn: exampleAwsMskCluster.Arn,
    			Name:       "example",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Msk.GetTopic.Invoke(new()
        {
            ClusterArn = exampleAwsMskCluster.Arn,
            Name = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.msk.MskFunctions;
    import com.pulumi.aws.msk.inputs.GetTopicArgs;
    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 example = MskFunctions.getTopic(GetTopicArgs.builder()
                .clusterArn(exampleAwsMskCluster.arn())
                .name("example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: aws:msk:getTopic
          arguments:
            clusterArn: ${exampleAwsMskCluster.arn}
            name: example
    

    Using getTopic

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getTopic(args: GetTopicArgs, opts?: InvokeOptions): Promise<GetTopicResult>
    function getTopicOutput(args: GetTopicOutputArgs, opts?: InvokeOptions): Output<GetTopicResult>
    def get_topic(cluster_arn: Optional[str] = None,
                  name: Optional[str] = None,
                  region: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetTopicResult
    def get_topic_output(cluster_arn: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  region: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetTopicResult]
    func LookupTopic(ctx *Context, args *LookupTopicArgs, opts ...InvokeOption) (*LookupTopicResult, error)
    func LookupTopicOutput(ctx *Context, args *LookupTopicOutputArgs, opts ...InvokeOption) LookupTopicResultOutput

    > Note: This function is named LookupTopic in the Go SDK.

    public static class GetTopic 
    {
        public static Task<GetTopicResult> InvokeAsync(GetTopicArgs args, InvokeOptions? opts = null)
        public static Output<GetTopicResult> Invoke(GetTopicInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTopicResult> getTopic(GetTopicArgs args, InvokeOptions options)
    public static Output<GetTopicResult> getTopic(GetTopicArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aws:msk/getTopic:getTopic
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ClusterArn string
    ARN of the MSK cluster.
    Name string
    Name of the MSK topic.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    ClusterArn string
    ARN of the MSK cluster.
    Name string
    Name of the MSK topic.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    clusterArn String
    ARN of the MSK cluster.
    name String
    Name of the MSK topic.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    clusterArn string
    ARN of the MSK cluster.
    name string
    Name of the MSK topic.
    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    cluster_arn str
    ARN of the MSK cluster.
    name str
    Name of the MSK topic.
    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    clusterArn String
    ARN of the MSK cluster.
    name String
    Name of the MSK topic.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.

    getTopic Result

    The following output properties are available:

    Arn string
    ARN of the MSK topic.
    ClusterArn string
    Configs string
    Aggregated Kafka configuration in JSON format for the topic.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    PartitionCount int
    Number of partitions for the topic.
    Region string
    ReplicationFactor int
    Replication factor for the topic.
    Arn string
    ARN of the MSK topic.
    ClusterArn string
    Configs string
    Aggregated Kafka configuration in JSON format for the topic.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    PartitionCount int
    Number of partitions for the topic.
    Region string
    ReplicationFactor int
    Replication factor for the topic.
    arn String
    ARN of the MSK topic.
    clusterArn String
    configs String
    Aggregated Kafka configuration in JSON format for the topic.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    partitionCount Integer
    Number of partitions for the topic.
    region String
    replicationFactor Integer
    Replication factor for the topic.
    arn string
    ARN of the MSK topic.
    clusterArn string
    configs string
    Aggregated Kafka configuration in JSON format for the topic.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    partitionCount number
    Number of partitions for the topic.
    region string
    replicationFactor number
    Replication factor for the topic.
    arn str
    ARN of the MSK topic.
    cluster_arn str
    configs str
    Aggregated Kafka configuration in JSON format for the topic.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    partition_count int
    Number of partitions for the topic.
    region str
    replication_factor int
    Replication factor for the topic.
    arn String
    ARN of the MSK topic.
    clusterArn String
    configs String
    Aggregated Kafka configuration in JSON format for the topic.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    partitionCount Number
    Number of partitions for the topic.
    region String
    replicationFactor Number
    Replication factor for the topic.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    Viewing docs for AWS v7.28.0
    published on Thursday, Apr 30, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.