Hello folks
After switch the backend to GCS, I still notice that the state file is generated every time I run apply locally.
Accordingly to document: " When using remote state, state is only ever held in memory when used by Terraform. It may be encrypted at rest, but this depends on the specific remote state backend."
is there anyway to stop generating a local copy of state file and make local apply really that “state is only ever held in memory”??
thank you
Hi @liycheng,
The documentation is correct that once remote state is enabled Terraform will not store state information on local disk.
If you are still seeing Terraform write state information on local disk then it seems Terraform does not see your remote state configuration. Terraform will always either write to the remote location or the local disk, but never both at the same time.
Terraform does not automatically delete the local file representing the state when you enable a remote backend, so once you’ve migrated to remote state and verified that there’s a correct state snapshot stored in the remote location you can manually delete the terraform.tfstate
file and Terraform will not read or write it again.
1 Like