Open
Description
Working with digger I found an edge case that did not print an error on the workspace list
step but just failed with an error:
<removed to keep it short>
Lock result: true
Running command: terraform [init -upgrade=true -input=false -no-color]
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Upgrading modules...
<hidden>
Initializing provider plugins...
<hidden>
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Running command: terraform [workspace list]
Error: exit status 1
Failed to run digger plan command. error executing plan: exit status 1
Failed to run commands. error while running command: Failed to run digger plan command. error executing plan: exit status 1
Error: Process completed with exit code 8.
It left me quite puzzled because I could not make out what was the problem at first, but it turned out that I had set an env variable in my digger.yaml:
projects:
- name: sandbox
dir: .
workflow: sandbox
workflows:
sandbox:
env_vars:
state:
- name: TF_CLI_ARGS
value: |
-backend-config=<hidden>
commands:
- name: TF_CLI_ARGS
value: -var-file=configs/sandbox.tfvars
auto_merge: false
collect_usage_data: false
On my machine this results in an error with a proper error message:
% terraform workspace list -var-file=configs/sandbox.tfvars
Usage: terraform [global options] workspace list
List Terraform workspaces.
Error parsing command-line flags: flag provided but not defined: -var-file
The solution is quite simply changing the variable to TF_CLI_ARGS_plan
, but neverthless, the actual error message was hidden by digger.
Activity