getporter / terraform-mixin

A Terraform Mixin for Porter
https://getporter.org/mixins/terraform
Apache License 2.0
17 stars 21 forks source link

Build step assumes that there is a directory named terraform #62

Open carolynvs opened 3 years ago

carolynvs commented 3 years ago
  1. Run porter create
  2. Add the terraform mixin
    mixins:
    - terraform
  3. Run porter build

This results in the following error

Error: unable to build CNAB invocation image: failed to stream docker build output: The command '/bin/sh -c cd /cnab/app/terraform && terraform init -backend=false' returned a non-zero code: 2

After making a directory named terraform at the root of the bundle, the build passes. Seems like we have a hard coded assumption about where the terraform files are kept that should more gracefully handle when it's not there, or return an error during lint.

evan-hines-js commented 1 year ago

From the readme. The workingDir configuration setting is the relative path to your terraform files. Defaults to "terraform". So this is expected behavior but the lint may be possible?

carolynvs commented 1 year ago

I added workingDir after this issue was opened. 😀 Seems like we can still have a lint check that validates that the workdinDir exists, to avoid having the bundle predictably fail when it is run.