Storing Terraform states files locally is not recommended. Instead you should use a backend such as as S3 from AWS.

To do this, you just need to add the following backend information in a terraform block in your code:

1
2
3
4
5
6
7
terraform {
  backend "s3" {
    bucket = "mybucket"
    key    = "path/to/my/key"
    region = "eu-west-1"
  }
}