Process Flow - Terraform apply -replace flag
Start terraform apply
Check -replace flag?
No→Normal apply
Yes
Mark specified resource for replacement
Destroy old resource
Create new resource
Apply other changes
Finish apply
Terraform apply checks if the -replace flag is used. If yes, it forces replacement of specified resources by destroying and recreating them during apply.