GetTopic

Use this data source to get the ARN of a topic in AWS Simple Notification Service (SNS). By using this data source, you can reference SNS topics without having to hard code the ARNs as input.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Aws.Sns.GetTopic.InvokeAsync(new Aws.Sns.GetTopicArgs
        {
            Name = "an_example_topic",
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/sns"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := sns.LookupTopic(ctx, &sns.LookupTopicArgs{
            Name: "an_example_topic",
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

example = aws.sns.get_topic(name="an_example_topic")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = pulumi.output(aws.sns.getTopic({
    name: "an_example_topic",
}, { async: true }));

Using GetTopic

function getTopic(args: GetTopicArgs, opts?: InvokeOptions): Promise<GetTopicResult>
function  get_topic(name=None, opts=None)
func LookupTopic(ctx *Context, args *LookupTopicArgs, opts ...InvokeOption) (*LookupTopicResult, error)

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

public static class GetTopic {
    public static Task<GetTopicResult> InvokeAsync(GetTopicArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

The friendly name of the topic to match.

Name string

The friendly name of the topic to match.

name string

The friendly name of the topic to match.

name str

The friendly name of the topic to match.

GetTopic Result

The following output properties are available:

Arn string

Set to the ARN of the found topic, suitable for referencing in other resources that support SNS topics.

Id string

The provider-assigned unique ID for this managed resource.

Name string
Arn string

Set to the ARN of the found topic, suitable for referencing in other resources that support SNS topics.

Id string

The provider-assigned unique ID for this managed resource.

Name string
arn string

Set to the ARN of the found topic, suitable for referencing in other resources that support SNS topics.

id string

The provider-assigned unique ID for this managed resource.

name string
arn str

Set to the ARN of the found topic, suitable for referencing in other resources that support SNS topics.

id str

The provider-assigned unique ID for this managed resource.

name str

Package Details

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