1. Packages
  2. AWS
  3. API Docs
  4. sqs
  5. RedriveAllowPolicy
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.sqs.RedriveAllowPolicy

Explore with Pulumi AI

Provides a SQS Queue Redrive Allow Policy resource.

Example Usage

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

const example = new aws.sqs.Queue("example", {name: "examplequeue"});
const src = new aws.sqs.Queue("src", {
    name: "srcqueue",
    redrivePolicy: pulumi.jsonStringify({
        deadLetterTargetArn: example.arn,
        maxReceiveCount: 4,
    }),
});
const exampleRedriveAllowPolicy = new aws.sqs.RedriveAllowPolicy("example", {
    queueUrl: example.id,
    redriveAllowPolicy: pulumi.jsonStringify({
        redrivePermission: "byQueue",
        sourceQueueArns: [src.arn],
    }),
});
Copy
import pulumi
import json
import pulumi_aws as aws

example = aws.sqs.Queue("example", name="examplequeue")
src = aws.sqs.Queue("src",
    name="srcqueue",
    redrive_policy=pulumi.Output.json_dumps({
        "deadLetterTargetArn": example.arn,
        "maxReceiveCount": 4,
    }))
example_redrive_allow_policy = aws.sqs.RedriveAllowPolicy("example",
    queue_url=example.id,
    redrive_allow_policy=pulumi.Output.json_dumps({
        "redrivePermission": "byQueue",
        "sourceQueueArns": [src.arn],
    }))
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sqs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := sqs.NewQueue(ctx, "example", &sqs.QueueArgs{
			Name: pulumi.String("examplequeue"),
		})
		if err != nil {
			return err
		}
		src, err := sqs.NewQueue(ctx, "src", &sqs.QueueArgs{
			Name: pulumi.String("srcqueue"),
			RedrivePolicy: example.Arn.ApplyT(func(arn string) (pulumi.String, error) {
				var _zero pulumi.String
				tmpJSON0, err := json.Marshal(map[string]interface{}{
					"deadLetterTargetArn": arn,
					"maxReceiveCount":     4,
				})
				if err != nil {
					return _zero, err
				}
				json0 := string(tmpJSON0)
				return pulumi.String(json0), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		_, err = sqs.NewRedriveAllowPolicy(ctx, "example", &sqs.RedriveAllowPolicyArgs{
			QueueUrl: example.ID(),
			RedriveAllowPolicy: src.Arn.ApplyT(func(arn string) (pulumi.String, error) {
				var _zero pulumi.String
				tmpJSON1, err := json.Marshal(map[string]interface{}{
					"redrivePermission": "byQueue",
					"sourceQueueArns": []string{
						arn,
					},
				})
				if err != nil {
					return _zero, err
				}
				json1 := string(tmpJSON1)
				return pulumi.String(json1), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

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

    var src = new Aws.Sqs.Queue("src", new()
    {
        Name = "srcqueue",
        RedrivePolicy = Output.JsonSerialize(Output.Create(new Dictionary<string, object?>
        {
            ["deadLetterTargetArn"] = example.Arn,
            ["maxReceiveCount"] = 4,
        })),
    });

    var exampleRedriveAllowPolicy = new Aws.Sqs.RedriveAllowPolicy("example", new()
    {
        QueueUrl = example.Id,
        RedriveAllowPolicyName = Output.JsonSerialize(Output.Create(new Dictionary<string, object?>
        {
            ["redrivePermission"] = "byQueue",
            ["sourceQueueArns"] = new[]
            {
                src.Arn,
            },
        })),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sqs.Queue;
import com.pulumi.aws.sqs.QueueArgs;
import com.pulumi.aws.sqs.RedriveAllowPolicy;
import com.pulumi.aws.sqs.RedriveAllowPolicyArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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) {
        var example = new Queue("example", QueueArgs.builder()
            .name("examplequeue")
            .build());

        var src = new Queue("src", QueueArgs.builder()
            .name("srcqueue")
            .redrivePolicy(example.arn().applyValue(_arn -> serializeJson(
                jsonObject(
                    jsonProperty("deadLetterTargetArn", _arn),
                    jsonProperty("maxReceiveCount", 4)
                ))))
            .build());

        var exampleRedriveAllowPolicy = new RedriveAllowPolicy("exampleRedriveAllowPolicy", RedriveAllowPolicyArgs.builder()
            .queueUrl(example.id())
            .redriveAllowPolicy(src.arn().applyValue(_arn -> serializeJson(
                jsonObject(
                    jsonProperty("redrivePermission", "byQueue"),
                    jsonProperty("sourceQueueArns", jsonArray(_arn))
                ))))
            .build());

    }
}
Copy
resources:
  src:
    type: aws:sqs:Queue
    properties:
      name: srcqueue
      redrivePolicy:
        fn::toJSON:
          deadLetterTargetArn: ${example.arn}
          maxReceiveCount: 4
  example:
    type: aws:sqs:Queue
    properties:
      name: examplequeue
  exampleRedriveAllowPolicy:
    type: aws:sqs:RedriveAllowPolicy
    name: example
    properties:
      queueUrl: ${example.id}
      redriveAllowPolicy:
        fn::toJSON:
          redrivePermission: byQueue
          sourceQueueArns:
            - ${src.arn}
Copy

Create RedriveAllowPolicy Resource

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

Constructor syntax

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

@overload
def RedriveAllowPolicy(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       queue_url: Optional[str] = None,
                       redrive_allow_policy: Optional[str] = None)
func NewRedriveAllowPolicy(ctx *Context, name string, args RedriveAllowPolicyArgs, opts ...ResourceOption) (*RedriveAllowPolicy, error)
public RedriveAllowPolicy(string name, RedriveAllowPolicyArgs args, CustomResourceOptions? opts = null)
public RedriveAllowPolicy(String name, RedriveAllowPolicyArgs args)
public RedriveAllowPolicy(String name, RedriveAllowPolicyArgs args, CustomResourceOptions options)
type: aws:sqs:RedriveAllowPolicy
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. RedriveAllowPolicyArgs
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. RedriveAllowPolicyArgs
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. RedriveAllowPolicyArgs
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. RedriveAllowPolicyArgs
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. RedriveAllowPolicyArgs
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 redriveAllowPolicyResource = new Aws.Sqs.RedriveAllowPolicy("redriveAllowPolicyResource", new()
{
    QueueUrl = "string",
    RedriveAllowPolicyName = "string",
});
Copy
example, err := sqs.NewRedriveAllowPolicy(ctx, "redriveAllowPolicyResource", &sqs.RedriveAllowPolicyArgs{
	QueueUrl:           pulumi.String("string"),
	RedriveAllowPolicy: pulumi.String("string"),
})
Copy
var redriveAllowPolicyResource = new RedriveAllowPolicy("redriveAllowPolicyResource", RedriveAllowPolicyArgs.builder()
    .queueUrl("string")
    .redriveAllowPolicy("string")
    .build());
Copy
redrive_allow_policy_resource = aws.sqs.RedriveAllowPolicy("redriveAllowPolicyResource",
    queue_url="string",
    redrive_allow_policy="string")
Copy
const redriveAllowPolicyResource = new aws.sqs.RedriveAllowPolicy("redriveAllowPolicyResource", {
    queueUrl: "string",
    redriveAllowPolicy: "string",
});
Copy
type: aws:sqs:RedriveAllowPolicy
properties:
    queueUrl: string
    redriveAllowPolicy: string
Copy

RedriveAllowPolicy 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 RedriveAllowPolicy resource accepts the following input properties:

QueueUrl
This property is required.
Changes to this property will trigger replacement.
string
The URL of the SQS Queue to which to attach the policy
RedriveAllowPolicyName This property is required. string
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
QueueUrl
This property is required.
Changes to this property will trigger replacement.
string
The URL of the SQS Queue to which to attach the policy
RedriveAllowPolicy This property is required. string
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queueUrl
This property is required.
Changes to this property will trigger replacement.
String
The URL of the SQS Queue to which to attach the policy
redriveAllowPolicy This property is required. String
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queueUrl
This property is required.
Changes to this property will trigger replacement.
string
The URL of the SQS Queue to which to attach the policy
redriveAllowPolicy This property is required. string
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queue_url
This property is required.
Changes to this property will trigger replacement.
str
The URL of the SQS Queue to which to attach the policy
redrive_allow_policy This property is required. str
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queueUrl
This property is required.
Changes to this property will trigger replacement.
String
The URL of the SQS Queue to which to attach the policy
redriveAllowPolicy This property is required. String
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.

Outputs

All input properties are implicitly available as output properties. Additionally, the RedriveAllowPolicy 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 RedriveAllowPolicy Resource

Get an existing RedriveAllowPolicy 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?: RedriveAllowPolicyState, opts?: CustomResourceOptions): RedriveAllowPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        queue_url: Optional[str] = None,
        redrive_allow_policy: Optional[str] = None) -> RedriveAllowPolicy
func GetRedriveAllowPolicy(ctx *Context, name string, id IDInput, state *RedriveAllowPolicyState, opts ...ResourceOption) (*RedriveAllowPolicy, error)
public static RedriveAllowPolicy Get(string name, Input<string> id, RedriveAllowPolicyState? state, CustomResourceOptions? opts = null)
public static RedriveAllowPolicy get(String name, Output<String> id, RedriveAllowPolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:sqs:RedriveAllowPolicy    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:
QueueUrl Changes to this property will trigger replacement. string
The URL of the SQS Queue to which to attach the policy
RedriveAllowPolicyName string
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
QueueUrl Changes to this property will trigger replacement. string
The URL of the SQS Queue to which to attach the policy
RedriveAllowPolicy string
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queueUrl Changes to this property will trigger replacement. String
The URL of the SQS Queue to which to attach the policy
redriveAllowPolicy String
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queueUrl Changes to this property will trigger replacement. string
The URL of the SQS Queue to which to attach the policy
redriveAllowPolicy string
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queue_url Changes to this property will trigger replacement. str
The URL of the SQS Queue to which to attach the policy
redrive_allow_policy str
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.
queueUrl Changes to this property will trigger replacement. String
The URL of the SQS Queue to which to attach the policy
redriveAllowPolicy String
The JSON redrive allow policy for the SQS queue. Learn more in the Amazon SQS dead-letter queues documentation.

Import

Using pulumi import, import SQS Queue Redrive Allow Policies using the queue URL. For example:

$ pulumi import aws:sqs/redriveAllowPolicy:RedriveAllowPolicy test https://queue.amazonaws.com/123456789012/myqueue
Copy

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

Package Details

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