AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi
aws.sns.getTopic
Explore with Pulumi AI
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
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.sns.getTopic({
name: "an_example_topic",
});
import pulumi
import pulumi_aws as aws
example = aws.sns.get_topic(name="an_example_topic")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Sns.GetTopic.Invoke(new()
{
Name = "an_example_topic",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.SnsFunctions;
import com.pulumi.aws.sns.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 = SnsFunctions.getTopic(GetTopicArgs.builder()
.name("an_example_topic")
.build());
}
}
variables:
example:
fn::invoke:
Function: aws:sns:getTopic
Arguments:
name: an_example_topic
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(name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetTopicResult
def get_topic_output(name: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, 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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:sns/getTopic:getTopic
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
- Friendly name of the topic to match.
- Dictionary<string, string>
- Map of tags for the resource.
- Name string
- Friendly name of the topic to match.
- map[string]string
- Map of tags for the resource.
- name String
- Friendly name of the topic to match.
- Map<String,String>
- Map of tags for the resource.
- name string
- Friendly name of the topic to match.
- {[key: string]: string}
- Map of tags for the resource.
- name str
- Friendly name of the topic to match.
- Mapping[str, str]
- Map of tags for the resource.
- name String
- Friendly name of the topic to match.
- Map<String>
- Map of tags for the resource.
getTopic Result
The following output properties are available:
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.