Terraform destroy is the only way to remove infrastructure.
Terraform destroy is the only way to remove infrastructure.
Terraform destroy is not the only way to remove infrastructure. Resources can also be removed by deleting or commenting out the resource block in the configuration file and then running terraform apply. This will instruct Terraform to remove the resources that are no longer defined in the configuration.
B. by commenting the resource block in the configuration file will also destroy the resources
"terraform apply -destroy" would be an alias for "terraform destroy" B for sure
False: the primary way to delete infrastructure managed by Terraform is to remove the corresponding declarations from your configuration and run terraform apply. terraform destroy (or, equivalently, terraform apply -destroy) is for the less common situation where you want to destroy everything managed by a particular configuration, which is not an everyday operation for long-lived infrastructure but can be useful for short-lived infrastructure such as one-time testing environments. https://discuss.hashicorp.com/t/is-terraform-destroy-the-only-way/36619/4
B for Sure
correct, you can also remove the resource definition in the state file if you previously stated it, it will detect the resource definition is absent and will delete the resource Unless you state the resource, but someone delete it manually, it will recreate it
if you remove just from state, terrafrom will forgot about resource and just create new one on next apply, so first instance will not be deleted