cool-easter-32542
04/21/2025, 2:03 PMshell_command to create a Terraform workspace that can be used by a subsequent terraform_deployment target. The BUILD file looks like the following:
shell_command(
command="terraform workspace new ${TF_WORKSPACE} || terraform workspace select ${TF_WORKSPACE}",
tools=["terraform"],
extra_env_vars=["TF_WORKSPACE"],
log_output=True
)
terraform_deployment(
dependencies=[
":shell_command",
...
],
)
...
However, when I run this with TF_WORKSPACE="my-workspace" pants experimental-deploy --dry-run :: the shell_command doesn't seem to run and goes right to the deployment where I get a "the currently selected workspace (my-workspace) does not exist" error.
Any help would be appreciated. Thanks!
pantsbuild/pants