Currently Terraspace doesn't support terraform workspaces unless you change into the Terraspace cache directory and run your commands directly from there.
Motivation
Workspaces are really handy for creating ephemeral environments so it would be nice if Terraspace could support them natively by wrapping around the terraform workspace command.
We can add commands like new and select to the terraform lifecycle hooks (terraform.rb) but commands like list, show and delete will require switching to the cache directory to run them.
Reference-level explanation
Ideally we would be able to run the terraform workspace commands via Terraspace from the root of the project on the current TS_ENV.
So something like this ~
terraspace workspace <stack_name> new <workspace_name>
terraspace workspace <stack_name> select <workspace_name>
terraspace workspace <stack_name> delete <workspace_name>
terraspace workspace <stack_name> list
terraspace workspace <stack_name> show
Drawbacks
Maybe the amount of arguments and ordering of arguments could get quite confusing, but very open to making it simpler if possible.
Worth mentioning that the TF commands TS uses will already automatically pick up the value of the TF_WORKSPACE environment variable (see the TF docs here) so you can already use workspaces with TS this way.
Summary
Currently Terraspace doesn't support terraform workspaces unless you change into the Terraspace cache directory and run your commands directly from there.
Motivation
Workspaces are really handy for creating ephemeral environments so it would be nice if Terraspace could support them natively by wrapping around the terraform workspace command.
We can add commands like
new
andselect
to the terraform lifecycle hooks (terraform.rb
) but commands likelist
,show
anddelete
will require switching to the cache directory to run them.Reference-level explanation
Ideally we would be able to run the terraform workspace commands via Terraspace from the root of the project on the current
TS_ENV
.So something like this ~
Drawbacks
Maybe the amount of arguments and ordering of arguments could get quite confusing, but very open to making it simpler if possible.
Unresolved Questions
N/A