Backend Local

Here’s an example with the local backend.

config/terraform/backend.tf:

terraform {
  backend "local" {
    path = "terraform.tfstate"
  }
}

The local statefile is stored at:

ls .terraspace-cache/dev/stacks/demo/terraform.tfstate

Note: When using a local backend, the config/terraform/backend.tf file is entirely optional. Terraform defaults to a local backend with the path = "terraform.tfstate". The backend.tf is provided as an example and shows you how to change the path.

Prefix Path

If you’re wondering how the prefix path .terraspace-cache/dev/stacks/demo was determined. It’s controlled by

config/app.rb:

Terraspace.configure do |config|
  config.build.cache_dir = ":REGION/:APP/:ROLE/:ENV/:BUILD_DIR"
end

For defaults, see: config/reference

More tools: