Skip to content

Instantly share code, notes, and snippets.

@amacal
Created November 6, 2020 16:26
Show Gist options
  • Save amacal/4068619ee9ced2300aa825230b66185c to your computer and use it in GitHub Desktop.
Save amacal/4068619ee9ced2300aa825230b66185c to your computer and use it in GitHub Desktop.
resource "aws_sqs_queue_policy" "orders_to_process_subscription" {
queue_url = aws_sqs_queue.orders_to_process.id
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "sns.amazonaws.com"
},
"Action": [
"sqs:SendMessage"
],
"Resource": [
"${aws_sqs_queue.orders_to_process.arn}"
],
"Condition": {
"ArnEquals": {
"aws:SourceArn": "${aws_sns_topic.orders.arn}"
}
}
}
]
}
EOF
}
resource "aws_sqs_queue_policy" "orders_to_notify_subscription" {
queue_url = aws_sqs_queue.orders_to_notify.id
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "sns.amazonaws.com"
},
"Action": [
"sqs:SendMessage"
],
"Resource": [
"${aws_sqs_queue.orders_to_notify.arn}"
],
"Condition": {
"ArnEquals": {
"aws:SourceArn": "${aws_sns_topic.orders.arn}"
}
}
}
]
}
EOF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment