Skip to content

Instantly share code, notes, and snippets.

@a-nldisr
Created July 10, 2020 16:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
# Attach the public ELBs to the instance if they change
resource "aws_elb_attachment" "default" {
depends_on = [var.elb_depends_on]
for_each = toset(local.instance_ids)
elb = aws_elb.default.id
instance = each.value
}
@a-nldisr
Copy link
Author

  63:   for_each                = toset(local.instance_ids)

The "for_each" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the for_each depends on.```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment