cloudnloud / weekly-cloud-engineer-interview-program

12-week-cloud-engineer-program
34 stars 3 forks source link

how can we restore the resource if we deleted and any possibility of make changes in tf state file #6

Open anillaghuvarapu opened 1 year ago

anillaghuvarapu commented 1 year ago

1.how can we restore the resource if we deleted by mistake? can we restore with tf state file or any other approach. 2.Is it possibility of make changes in tf state file which may impact the resources?

bsrinivasanCbe commented 1 year ago
  1. When you plan or apply your tf files, terraform will prepare the configuration state file (tfstate file). so when accidentally deleted you can able to recreate with apply command.
  2. As a best practice don't touch the tfstate file instead do changes in tf file and try prepare the plan and apply the changes.
  3. If there is any specific case where you want to touch tfstate file do let us know, we will check on that, thanks