terraform-mixin
terraform-mixin copied to clipboard
Make the working directory configurable per command
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
We should consider using terraform's -chdir to solve this instead of cd <workingDir> && terraform
Need to have the mixin config accept multiple workingDirs as well:
mixins:
- terraform:
workingDirs:
- mymodule1
- mymodule2
Also need to figure out the case at the action level:
mixins:
- terraform:
workingDirs:
- mymodule1
- mymodule2
install
- terraform:
workingDir: "mymodule1"
- terraform:
workingDir: "mymodule2"
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.