Remote Backend

By default, the generated test harness does not configure a remote backend. You can easily configure the test harness to use a remote backend, though. This can make debugging the test harness easier because:

How To

To configure a remote backend for a test harness create a fixture like so:


terraform {
  backend "s3" {
    bucket         = "<%= expansion('terraform-state-:ACCOUNT-:REGION-:ENV') %>"
    key            = "<%= expansion(':PROJECT/:TYPE_DIR/:APP/:ROLE/:MOD_NAME/:ENV/:EXTRA/:REGION/terraform.tfstate') %>"
    region         = "<%= expansion(':REGION') %>"
    encrypt        = true
    dynamodb_table = "terraform_locks"

In the build_test_harness method, use it:

  name: "example-harness",
  modules: {example: mod_path},
  # See:
  config: "spec/fixtures/config", # <= The fixutre/config containers the terraform/
  tfvars: {demo: "spec/fixtures/tfvars/test.tfvars"},

More tools: