getQueue function

Future<GetQueueResult> getQueue(
  1. GetQueueArgs args, {
  2. InvokeOptions? options,
})

Use this data source to get the ARN and URL of queue in AWS Simple Queue Service (SQS). By using this data source, you can reference SQS queues without having to hardcode the ARNs as input.

> NOTE: To use this data source, you must have the sqs:GetQueueAttributes and sqs:GetQueueURL permissions.

Example Usage

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

const example = aws.sqs.getQueue({
    name: "queue",
});
import pulumi
import pulumi_aws as aws

example = aws.sqs.get_queue(name="queue")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = Aws.Sqs.GetQueue.Invoke(new()
    {
        Name = "queue",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sqs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sqs.LookupQueue(ctx, &sqs.LookupQueueArgs{
			Name: "queue",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_sqs_getqueue" "example" {
  name = "queue"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sqs.SqsFunctions;
import com.pulumi.aws.sqs.inputs.GetQueueArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 = SqsFunctions.getQueue(GetQueueArgs.builder()
            .name("queue")
            .build());

    }
}
variables:
  example:
    fn::invoke:
      function: aws:sqs:getQueue
      arguments:
        name: queue

args Arguments passed to this invoke. Arguments for getQueue. options Invoke options controlling this call.

Implementation

Future<GetQueueResult> getQueue(
  GetQueueArgs args, {
  pulumi.InvokeOptions? options,
}) async {
  final deployment = pulumi.Deployment.instance;
  final result = await deployment.invoke<Map<String, dynamic>>(
    'aws:sqs/getQueue:getQueue',
    args.toMap(),
    options: pulumi.toDeploymentInvokeOptions(options),
  );
  return GetQueueResult.fromMap(result);
}