fixup count transition for refresh state

We need to do this for both states during plan
This commit is contained in:
James Bardin 2020-09-10 17:59:30 -04:00
parent 7d6472dad0
commit ced7aedeca
1 changed files with 6 additions and 2 deletions

View File

@ -117,8 +117,12 @@ func evaluateCountExpressionValue(expr hcl.Expression, ctx EvalContext) (cty.Val
// or this function will block forever awaiting the lock.
func fixResourceCountSetTransition(ctx EvalContext, addr addrs.ConfigResource, countEnabled bool) {
state := ctx.State()
changed := state.MaybeFixUpResourceInstanceAddressForCount(addr, countEnabled)
if changed {
if state.MaybeFixUpResourceInstanceAddressForCount(addr, countEnabled) {
log.Printf("[TRACE] renamed first %s instance in transient state due to count argument change", addr)
}
refreshState := ctx.RefreshState()
if refreshState != nil && refreshState.MaybeFixUpResourceInstanceAddressForCount(addr, countEnabled) {
log.Printf("[TRACE] renamed first %s instance in transient state due to count argument change", addr)
}
}