From 1c338c4951587b4281ffb87ebc78a401c99fc558 Mon Sep 17 00:00:00 2001 From: Pam Selle Date: Wed, 11 Sep 2019 09:36:24 -0400 Subject: [PATCH] Add source addressing to make error more useful This commit was generated from hashicorp/terraform#22760. --- terraform/eval_for_each.go | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/eval_for_each.go b/terraform/eval_for_each.go index c2c9d74a3ee..43a61478b57 100644 --- a/terraform/eval_for_each.go +++ b/terraform/eval_for_each.go @@ -21,6 +21,7 @@ func evaluateResourceForEachExpression(expr hcl.Expression, ctx EvalContext) (fo Severity: hcl.DiagError, Summary: "Invalid forEach argument", Detail: `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.`, + Subject: expr.Range().Ptr(), }) } return forEachMap, diags