Terraform CLI introduced an upgrade command (can't remember what it's called) that automatically does this for you.