Terraform does not respect the order of operations for modify operations

I think this ignored ticket describes the problem very well Terraform deletes/modifies resource and its dependency simultaneously · Issue #23169 · hashicorp/terraform · GitHub

In short - when the resource is updated in place, dependencies are ignored (implicit or explicit dependencies) and so is the order of operations

So if you need to delete one resource and update one that depends on the resource you are deleting terraform will try to delete the resource first and then modify the other, which is wrong since it depends on the resource that is being deleted.

Are there any workarounds for that behavior? Are you interested in fixing this? I can create a new github issue with a fairly simple reproducible scenario if you want

Hi @vladimir-avinkin,

The linked issue would only be relevant for very old versions of terraform, so I suspect that the issue is not related to what you are describing.

The correct order for a deletion and update of its dependent is the order you listed, because by default terraform uses a delete-then-create ordering. If you want the update to happen before the deletion, then you need to specify create_before_destroy in one of the resource’s lifecycle blocks.

No, you did not understand me.

I created the issue which has a reproduction case and hopefully a better explanation of what i mean