Pass Files

Terraspace builds a terraform project from files like app/stacks. Files that end with .tf and .rb get processed with different strategies as part of being built.

Extension Strategy
.tf Will be processed with ERB. This allows add a little extra power to the Terraform HCL language with templating logic.
.rb Will be processed by the Terraspace Ruby DSL. This allows you to write Terraform code with Ruby.

There are cases where it makes sense to do no processing at all. For example, lambda function ruby files like lambda_function.rb should not be processed by the Terraspace DSL.

files

By default, the files folder within modules or stacks will be copied straight to the build cache without any processing. This is call the “pass” strategy. For example:

app/stacks/demo/files/lambda_function.rb

Will build:

$ terraspace build demo
$ ls .terraspace-cache/us-west-2/dev/stacks/demo/files/
lambda_function.rb
$

Configurable

You can configure additional patterns to use the pass strategy.

config/app.rb

Terraspace.configure do |config|
  config.build.pass_files = ["myfiles"]
end

More tools: