Terraform resource: aws sns topic subscription
(Redirected from Aws sns topic subscription)
Jump to navigation
Jump to search
aws_sns_topic_subscription (tf.io)
Official example[edit]
resource "aws_sns_topic_subscription" "user_updates_sqs_target" {
topic_arn = "arn:aws:sns:us-west-2:432981146916:user-updates-topic"
protocol = "sqs"
endpoint = "arn:aws:sqs:us-west-2:432981146916:terraform-queue-too"
}
Grok example with redrive_policy[edit]
resource "aws_sns_topic_subscription" "example_subscription" {
topic_arn = aws_sns_topic.example_topic.arn
protocol = "sqs" # Example using an SQS queue as the subscriber
endpoint = aws_sqs_queue.example_queue.arn # Subscriber queue ARN
# Redrive policy specifying the dead-letter queue
redrive_policy = jsonencode({
deadLetterTargetArn = aws_sqs_queue.dead_letter_queue.arn
})
# Ensure the subscription depends on the DLQ policy being applied
depends_on = [aws_sqs_queue_policy.dlq_policy]
}
Related[edit]
See also[edit]
Advertising: