<#22208 Using `shell_command` with `terraform_depl...
# github-notifications
c
#22208 Using `shell_command` with `terraform_deployment` New discussion created by d-m Hello, I am trying to use
shell_command
to create a Terraform workspace that can be used by a subsequent
terraform_deployment
target. The
BUILD
file looks like the following:
Copy code
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