Open slavaaaaaaaaaa opened 5 years ago
i would also love to see this enhancement in a future release.
I think that Terraform workspaces accomplish something similar but I have always just used a similar make system as in naftulikay/terrakang
This would at the very least bring more consistency to the terraform CLI, something it can control and not an inconsistency brought about due to the AWS API (such as tag vs tags)
If I understood correctly this issue - we do not have any problem with it.
You should use module
This can be used as follows
"tf-dev:plan": "cd ./infrastructure/development && terraform init -get=true && terraform plan -out=terraform.tfplan",
"tf-dev:apply": "cd ./infrastructure/development && terraform apply terraform.tfplan",
@eXist-FraGGer of course one can cd
into the needed directory and cd
out of it afterwards, but that is exactly why I'm requesting this feature: to avoid having to do that. These are extra steps that tend to cause issues in scripts - there's a reason Make supports this.
Current Terraform Version
Use-cases
It would be nice to be able to set working directory on all terraform commands. As I understand, this is available for
apply
but notterraform output
, for example.Attempted Solutions
terraform output gcp/staging/resource
naturally does not work, because the expected argument is the name of the output, not the working directory.My current solution is as follows:
terraform output
is defined as amake
targetmake -C somewhere/ output
from wherever I need toProposal
I propose a solution similar to that of make: e.g.,
make -C gcp/staging/resource pizza
. This flag,-C
, is to be available on all terraform commands and will set the working directory.References
I apologize if a similar issue already exists, as I have not found any in my searches.