Hi all. Can somebody clarify how terraform works with tfstate? For example, you have AWS infrastructure configured with terraform. Also you have .tfstate file for this infrastructure, with was automaticaly generated by terraform, during terraform apply process. Naw you want to make changes to your AWS infrastructure: add a new subnet. To do so you make necessary changes into .tf file. During next #terraform deploy processs, does terraform compare the changes made (changed .tf file) only with the .tfstate file, or terraform compare the real AWS infrastructure (not the .tfstate file) with the changes made (changed .tf file)?
In other words, does terraform only work with the .tfstate file to determine the current environment configuration, or terraform work directly with AWS to determine the current environment configuration?
Is it possible to make further changes/support to the existing infrastructure if the .tfstate file is lost?
Thank you in advance.