Created
August 31, 2016 08:51
-
-
Save garo/974113c6d1f056973efdb8357ceb7e96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "topics" { | |
default = ["new_users", "deleted_users"] | |
} | |
variable "environments" { | |
default = ["prod", "staging", "testing", "development] | |
} | |
for $topic in topics { | |
# Define SNS topics which are shared between all environments | |
resource "aws_sns_topic" "$topic.$env" { ... } | |
for $env in environments { | |
# Then for each topic define a queue for each env | |
resource "aws_sqs_queue" "$topic.$env-processors" { ... } | |
# And bind the created queue to its sns topic | |
resource "aws_sns_topic_subscription" "$topic.$env-to-$topic.$env-processors" { | |
topic_arn = "${aws_sns_topic.${topic.$env}.arn}" | |
endpoint = "${aws_sqs_queue.{$topic.$env-processors}.arn}" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment