Build Cache Dir

The build.cache_dir setting controls where the generated terraform project will be built. It’s set to a reasonable and conventional default. If you wish, you also can override and fully control the path. Here’s the default:

Terraspace.configure do |config| = nil # defaults to /full/path/to/.terraspace-cache = ":CACHE_ROOT/:REGION/:ENV/:BUILD_DIR" # default

Interface: String or Object

The build.cache_dir can take:

  1. a String or
  2. an Object that responds to the call method.

String Interface

When setting it as a String, Terraspace uses it as a pattern and substitute values. For example,

Terraspace.configure do |config| = ":CACHE_ROOT/:REGION/:ENV/:BUILD_DIR"

Can produce:


Object Interface

When setting it as a Object, the instance method call should also return a String with a pattern for Terraspace to use for substitution.

class CustomBuildDir
  def call(mod)
    ":CACHE_ROOT/my-cache/:NAMESPACE/:REGION/:ENV/:BUILD_DIR" # String is returned

Terraspace.configure do |config| = CustomBuildDir

The Object can also respond with class method call. The current module or stack is passed to the call method also.

More tools: