terraform-mixin icon indicating copy to clipboard operation
terraform-mixin copied to clipboard

Make the working directory configurable per command

Open carolynvs opened this issue 4 years ago • 4 comments
trafficstars

I recently added working directory as a mixin level config, which lets the user override the default directory with all their terraform files. #61 Sometimes people have multiple terraform modules though, and its not possible to use more than one in the same bundle. We should add working directory to the terraform mixin command so that you can do something like this:

install:
  - terraform:
       workingDir: mymodule1
  - terraform:
       workingDir: mymodule2

carolynvs avatar Sep 07 '21 14:09 carolynvs

We should consider using terraform's -chdir to solve this instead of cd <workingDir> && terraform

bdegeeter avatar Mar 20 '24 21:03 bdegeeter

Need to have the mixin config accept multiple workingDirs as well:

mixins:
  - terraform:
       workingDirs:
         - mymodule1
         - mymodule2

sgettys avatar Mar 21 '24 04:03 sgettys

Also need to figure out the case at the action level:

mixins:
  - terraform:
       workingDirs:
         - mymodule1
         - mymodule2
install
  - terraform:
       workingDir: "mymodule1"
  - terraform:
       workingDir: "mymodule2"

sgettys avatar Mar 21 '24 05:03 sgettys

Logic to support this would need to be able to mutually exclusively set "workingDir" or "workingDirs" at the mixin level so that the terraform can be built into the bundle. And then require at the action level if "workingDirs" is set that each terraform action requires one of the values set in the mixin config.

sgettys avatar Mar 21 '24 05:03 sgettys