Will Terraform destroy the resources I just remove from my .tf file?

3.4k views Asked by At

I won't destroy the infra with the command, I will just update the file, removing some resources of it -for readibility reasons

1

There are 1 answers

0
Dan Monego On

Terraform works to keep the resources on the server in sync with what's in your configuration. If you delete a resource, it will be removed on the next apply.

If you don't want that to happen, the best way to keep a .tf file readable is to create another .tf file in the same directory and copy the resources there. Terraform will treat all .tf files in the same directory as if they are in the same scope, so no effort is needed to import the files.