op run and multiple commands/arguments?

trahman
trahman
Community Member
edited May 18 in CLI

The "op run" documentation indicates that the script can take two commands:
https://developer.1password.com/docs/cli/reference/commands/run/

Is it possible to feed through more than just two commands?

I'm experimenting with using 1password CLI to feed secrets to some lab terraform scripts to enact changes to a local test Hyper-V instance on my laptop. I've got things working using "op run" and feeding secrets through an env file. As an example:

op run --env-file="./tfvar.env" terraform apply

The above seems to work fine.

There's a slight time savings I can obtain by feeding an "-auto-approve" flag after "terraform apply" to eliminate a manual approval step to the run. However, if I try to add that:

op run --env-file="./tfvar.env" terraform apply -auto-approve

The command fails with an error:
unknown shorthand flag: 'a' in -auto-approve and then gives some "op run" guidance. I'm assuming that "op run" is thinking the "-auto-approve" is being fed to it instead of being fed to "terraform apply"?

Any suggestions as to how to feed "-auto-approve" to "terraform apply"?

Thanks.


1Password Version: 2.28.0
Extension Version: Not Provided
OS Version: Windows 10
Browser: MS Edge

Comments

  • Hi @trahman!

    Could you please try adding -- after the -env-file flag? So the command would look like op run --env-file="./tfvar.env" -- terraform apply -auto-approve. Let us know if that works for you!

    • Andy
This discussion has been closed.