-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for_each
is failing not yet created resources
#22629
Comments
@Menur Currently working on a fix for this panic, but the case you're writing will error/won't work, because the values passed to
Thank you for the report! |
Know means constant, right? data "aws_caller_identity" "current" {}
data "aws_region" "current" {}
locals {
topicARNs = [
for messageName in local.topics : "arn:aws:sns:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${local.prefix}-${messageName}"
]
}
resource "aws_sns_topic_subscription" "subscription" {
for_each = toset(local.topicARNs) ##toset(values(aws_sns_topic.topics)[*].arn)
protocol = "sqs"
endpoint = aws_sqs_queue.queue.arn
topic_arn = each.value
depends_on = [aws_sns_topic.topics]
} When region name and account_id are specified as constant strings in locals it works. |
@Menur Known doesn't mean constant, it's a bit different. Sorry to confirm that the crash will still happen with known values on the current release of Terraform -- my instructions for the work around ( |
|
@Menur Thanks so much for the report back! I'll close this issue when the upstream fix is released :) |
0.12.8 is out! https://www.terraform.io/downloads.html |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform Configuration Files
Crash Output
https://gist.github.com/Menur/228b400095d0f972226608123a12fde7
Expected Behavior
SQS and two SNS topics should be created and subscribed to SNS
Actual Behavior
Steps to Reproduce
terraform init
terraform plan
Additional Context
When SNS topics aren't created terraform will crash.
When SNS topics are created terraform will proceed.
The text was updated successfully, but these errors were encountered: