Skip to content

Instantly share code, notes, and snippets.

@a-nldisr
Created July 10, 2020 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-nldisr/8ea36b308a6834518707f545c87aa284 to your computer and use it in GitHub Desktop.
Save a-nldisr/8ea36b308a6834518707f545c87aa284 to your computer and use it in GitHub Desktop.
# 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