boltops-tools/terraspace

Terraspace doesn't handle using a local terraform cache

johnlister opened this issue · 0 comments

  • Upgrade Terraspace: Are you using the latest version of Terraspace? This allows Terraspace to fix issues fast. There's an Upgrading Guide: https://terraspace.cloud/docs/misc/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System WSL
Terraform 1.3.6
Terraspace 2.2.3
Ruby 3.0.3p157

Expected Behaviour

When you run Terraspace with local caching enabled in terraform, it should handle the case whereby a module hasn't been cached and run terraform init in the same way it does when local caching isn't enabled.

Current Behavior

Running Terraspace with local caching enabled in terraform results in a error as any new modules aren't installed and it doesn't automatically trigger terraform init. The following error is produced

Error: Module not installed

on legacy_api.tf line 13:
13: module "aws_api_gateway_rest_api" {

This module's local cache directory could not be read. Run "terraform
init" to install all modules required by this configuration.

Step-by-step reproduction instructions

Create a module under the apps folder and reference it in a stack. Enable local terraform caching. Either with an environment variable or add this line to your `.terraformrc` file `plugin_cache_dir = "$HOME/.terraform.cache" `

run terraspace against the stack

-->

Solution Suggestion

Terraspace should handle errors during plan/apply better from terraform in order to trigger the automatic init.