Created
August 31, 2016 10:07
-
-
Save garo/12b83a7d8c6bc078ac4be5599ef548a4 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 "foo" { | |
default = ["1", "2", "3"] | |
} | |
variable "bar" { | |
default = ["a", "b"] | |
} | |
resource "aws_sns_topic" "test" { | |
name = "${element(var.foo, count.index / length(var.bar))}-${element(var.bar, count.index)}" | |
count = "${length(var.foo) * length(var.bar)}" | |
} | |
resource "aws_sqs_queue" "listeners" { | |
name = "${element(var.foo, count.index / length(var.bar))}-${element(var.bar, count.index)}" | |
count = "${length(var.foo) * length(var.bar)}" | |
} | |
resource "aws_sns_topic_subscription" "sub-foo-to-bar" { | |
topic_arn = "${element(aws_sns_topic.test.*.arn)}" | |
protocol = "sqs" | |
endpoint = "${element(aws_sqs_queue.listeners.*.arn)}" | |
raw_message_delivery = true | |
count = "${length(var.foo) * length(var.bar)}" | |
} |
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
+ aws_sns_topic.test.0 | |
arn: "<computed>" | |
name: "1-a" | |
policy: "<computed>" | |
+ aws_sns_topic.test.1 | |
arn: "<computed>" | |
name: "1-b" | |
policy: "<computed>" | |
+ aws_sns_topic.test.2 | |
arn: "<computed>" | |
name: "2-a" | |
policy: "<computed>" | |
+ aws_sns_topic.test.3 | |
arn: "<computed>" | |
name: "2-b" | |
policy: "<computed>" | |
+ aws_sns_topic.test.4 | |
arn: "<computed>" | |
name: "3-a" | |
policy: "<computed>" | |
+ aws_sns_topic.test.5 | |
arn: "<computed>" | |
name: "3-b" | |
policy: "<computed>" | |
+ aws_sns_topic_subscription.sub-foo-to-bar.0 | |
arn: "<computed>" | |
confirmation_timeout_in_minutes: "1" | |
endpoint: "${element(aws_sqs_queue.listeners.*.arn)}" | |
endpoint_auto_confirms: "false" | |
protocol: "sqs" | |
raw_message_delivery: "true" | |
topic_arn: "${element(aws_sns_topic.test.*.arn)}" | |
+ aws_sns_topic_subscription.sub-foo-to-bar.1 | |
arn: "<computed>" | |
confirmation_timeout_in_minutes: "1" | |
endpoint: "${element(aws_sqs_queue.listeners.*.arn)}" | |
endpoint_auto_confirms: "false" | |
protocol: "sqs" | |
raw_message_delivery: "true" | |
topic_arn: "${element(aws_sns_topic.test.*.arn)}" | |
+ aws_sns_topic_subscription.sub-foo-to-bar.2 | |
arn: "<computed>" | |
confirmation_timeout_in_minutes: "1" | |
endpoint: "${element(aws_sqs_queue.listeners.*.arn)}" | |
endpoint_auto_confirms: "false" | |
protocol: "sqs" | |
raw_message_delivery: "true" | |
topic_arn: "${element(aws_sns_topic.test.*.arn)}" | |
+ aws_sns_topic_subscription.sub-foo-to-bar.3 | |
arn: "<computed>" | |
confirmation_timeout_in_minutes: "1" | |
endpoint: "${element(aws_sqs_queue.listeners.*.arn)}" | |
endpoint_auto_confirms: "false" | |
protocol: "sqs" | |
raw_message_delivery: "true" | |
topic_arn: "${element(aws_sns_topic.test.*.arn)}" | |
+ aws_sns_topic_subscription.sub-foo-to-bar.4 | |
arn: "<computed>" | |
confirmation_timeout_in_minutes: "1" | |
endpoint: "${element(aws_sqs_queue.listeners.*.arn)}" | |
endpoint_auto_confirms: "false" | |
protocol: "sqs" | |
raw_message_delivery: "true" | |
topic_arn: "${element(aws_sns_topic.test.*.arn)}" | |
+ aws_sns_topic_subscription.sub-foo-to-bar.5 | |
arn: "<computed>" | |
confirmation_timeout_in_minutes: "1" | |
endpoint: "${element(aws_sqs_queue.listeners.*.arn)}" | |
endpoint_auto_confirms: "false" | |
protocol: "sqs" | |
raw_message_delivery: "true" | |
topic_arn: "${element(aws_sns_topic.test.*.arn)}" | |
+ aws_sqs_queue.listeners.0 | |
arn: "<computed>" | |
delay_seconds: "0" | |
max_message_size: "262144" | |
message_retention_seconds: "345600" | |
name: "1-a" | |
receive_wait_time_seconds: "0" | |
visibility_timeout_seconds: "30" | |
+ aws_sqs_queue.listeners.1 | |
arn: "<computed>" | |
delay_seconds: "0" | |
max_message_size: "262144" | |
message_retention_seconds: "345600" | |
name: "1-b" | |
receive_wait_time_seconds: "0" | |
visibility_timeout_seconds: "30" | |
+ aws_sqs_queue.listeners.2 | |
arn: "<computed>" | |
delay_seconds: "0" | |
max_message_size: "262144" | |
message_retention_seconds: "345600" | |
name: "2-a" | |
receive_wait_time_seconds: "0" | |
visibility_timeout_seconds: "30" | |
+ aws_sqs_queue.listeners.3 | |
arn: "<computed>" | |
delay_seconds: "0" | |
max_message_size: "262144" | |
message_retention_seconds: "345600" | |
name: "2-b" | |
receive_wait_time_seconds: "0" | |
visibility_timeout_seconds: "30" | |
+ aws_sqs_queue.listeners.4 | |
arn: "<computed>" | |
delay_seconds: "0" | |
max_message_size: "262144" | |
message_retention_seconds: "345600" | |
name: "3-a" | |
receive_wait_time_seconds: "0" | |
visibility_timeout_seconds: "30" | |
+ aws_sqs_queue.listeners.5 | |
arn: "<computed>" | |
delay_seconds: "0" | |
max_message_size: "262144" | |
message_retention_seconds: "345600" | |
name: "3-b" | |
receive_wait_time_seconds: "0" | |
visibility_timeout_seconds: "30" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment