By Matt Burgess
WHATS TFSTATE ?
terraform.tfstate ctm.tfstate par exemple c le fichier qui régit l’état de l’infrastructure (toute les resource deployés par terraform après un APPLY)
donc apres un apply ce fichier là est updaté ) on peut le trouver en local ou bien en remote_state sur un s3 (pour que toute l’équipe ait accé à un meme tfstate file et tout le monde soit synchronisé)
WHY we USE BACKEND and remote State ?
So, we all understand the importance of state. Why would I want ‘remote state?’
Remote state comes into play through the use of ‘backends’. A backend tells Terraform that the snapshot of your infrastructure should no longer live in the terraform.tfstate
file on your local filesystem and that it should be stored in a remote location, such as Amazon S3. I personally use the S3 backend for all my projects so I’ll concentrate on that backend provider here, but the same principles apply to all the supported backends.
donc si j’utilise un backend ====> terraform va comprendre que le tfste à utiliser est en remote state sur un backend s3…
=======================
So, maybe you’re wondering what ‘state’ is. In Terraform terms, state is a snapshot of your infrastructure from when you last ran the terraform apply
command i.e. your s3 buckets, VPCs, DNS records and maybe even your Github repositories. All it really is, is a JSON file which contains details about every configuration attribute of each managed resource since you last applied your terraform scripts. It’s vitally important since it’s how Terraform understands what’s changed, what is new and what is no longer needed.


https://medium.com/@itsmattburgess/why-you-should-be-using-remote-state-in-terraform-2fe5d0f830e8