Is it possible to name the remote state file

I am using a remote state which hosts the Terraform state file in a AWS S3 bucket. The state file name by default is terraform.tfstate. I would like to give a more readable name to Terraform state file, e.g. “my_us_east_vpc.state” rather than “terraform.tfstate”, is it doable?

Thanks

For the S3 remote state backend, you can specify the key path where the state file is stored. I don’t think we have a documented process for renaming the state file, but I imagine you could:

  • Rename the state file in your S3 bucket manually
  • Update the key parameter in your Terraform config
  • Run terraform plan to make sure the state can still be read

I haven’t tested this, so please be careful if you do try it!