mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-04-10 21:02:01 -04:00
Previously we made a very generic suggestion to use -target to split a change into two parts as a workaround for the fact that count and for_each must be known during planning. That works, but we didn't have enough information available to tell the operator exactly what to target and so anyone who is not an expert on the configuration they're working with tends to get stuck unable to figure out exactly what they need to do. The new -exclude option gives us an opportunity to do better here: we tend to know for which object we're currently evaluating count or for_each, and so we can mention that object directly in the error message when if we recommend to use -exclude instead of -target. Not all objects that support count/for_each will necessarily be directly targetable, so we can still potentially recommend -target when we're dealing with one of those objects. For example, as of this commit that is true for for_each in a provider block, because there is not currently any syntax for specifying a provider configuration as an addrs.Targetable. Perhaps we'll introduce such a thing in the future, but that's outside the scope of this change that's primarily focused on improving the messaging for resource and module count/for_each. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>