-
Notifications
You must be signed in to change notification settings - Fork 251
Description
Platform or tool
HashiCorp Terraform
Desired or expected behavior
The Terraform shell plugin does not trigger authentication for the workspace subcommand.
As a result, commands such as:
terraform workspace list
terraform workspace select
terraform workspace new
do not provision credentials via the 1Password plugin, even though these commands require backend authentication. This leads to backend credential resolution failure such as:
Error: error configuring S3 Backend: no valid credential sources for S3 Backend found.
The expected behavior is having the workspace subcommand triggering authentication in the same way as init and state.
Proposed change:
needsauth.ForCommand("workspace"),
added to the existing NeedsAuth list.
Location: plugins/terraform/terraform.go
Inside the NeedsAuth Block
NeedsAuth: needsauth.IfAny(
needsauth.ForCommand("refresh"),
needsauth.ForCommand("init"),
needsauth.ForCommand("state"),
needsauth.ForCommand("plan"),
needsauth.ForCommand("apply"),
needsauth.ForCommand("destroy"),
needsauth.ForCommand("import"),
needsauth.ForCommand("test"),
needsauth.ForCommand("workspace"),
),
Current behavior
In plugins/terraform/terraform.go, the NeedsAuth block includes:
needsauth.ForCommand("refresh"),
needsauth.ForCommand("init"),
needsauth.ForCommand("state"),
needsauth.ForCommand("plan"),
needsauth.ForCommand("apply"),
needsauth.ForCommand("destroy"),
needsauth.ForCommand("import"),
needsauth.ForCommand("test"),
However, workspace is not included.
Because of this:
terraform init -> triggers authentication and it works
terraform plan/apply -> triggers authentication and it works
terraform workspace -> does NOT trigger authentication and fails
Since workspace interacts directly with the backend, it requires valid AWS credentials just like init.
Relevant log output
op CLI version
2.33.0-beta.02