Last active
December 20, 2016 06:40
-
-
Save gongo/362975d478a9f4b85b3a213ddcc4d0cf to your computer and use it in GitHub Desktop.
terraform plan displays "value of 'count' cannot be computed" https://github.com/hashicorp/terraform/issues/10857
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
# /path/to/main.tf | |
variable "aws_access_key" {} | |
variable "aws_secret_key" {} | |
provider "aws" { | |
access_key = "${var.aws_access_key}" | |
secret_key = "${var.aws_secret_key}" | |
region = "ap-northeast-1" | |
} | |
resource "aws_sns_topic" "test1" { | |
name = "test1" | |
} | |
resource "aws_sns_topic" "test2" { | |
name = "test2" | |
} | |
module "sns_subscription_to_lambda" { | |
source = "./module" | |
topic_arns = [ | |
"${aws_sns_topic.test1.arn}", | |
"${aws_sns_topic.test2.arn}", | |
] | |
} |
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
# /path/to/module/module.tf | |
variable "topic_arns" { | |
type = "list" | |
} | |
resource "aws_sns_topic_subscription" "event-test" { | |
count = "${length(var.topic_arns)}" | |
topic_arn = "${element(var.topic_arns, count.index)}" | |
protocol = "lambda" | |
endpoint = "arn:aws:lambda:ap-northeast-1:012345678901:function:test-event" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Debug log