shell-plugins icon indicating copy to clipboard operation
shell-plugins copied to clipboard

op run -- terraform <command> fails because it doesn't allow setting credentials

Open npearson72 opened this issue 11 months ago • 3 comments

op CLI version

2.30.3

Goal or desired behavior

For this to work:

op run --env-file=.env -- terraform <command>

Current behavior

Running op run --env-file=.env -- terraform <command> command throws the following error (without allowing to select credentials):

Error: NoCredentialProviders: no valid providers in chain. Deprecated.
      For verbose messaging see aws.Config.CredentialsChainVerboseErrors

I was required to remove the terraform alias in ~/.config/op/plugins.sh to get it t work. But now I have to use the following command:

op run --env-file=.env -- op plugin run -- terraform <command>

Relevant log output

Error: NoCredentialProviders: no valid providers in chain. Deprecated.
      For verbose messaging see aws.Config.CredentialsChainVerboseErrors

npearson72 avatar Jan 01 '25 00:01 npearson72

Thank you for reporting this issue, @npearson72!

Could you share the format of your .env file? It would be helpful to see what kind of environment variables you're trying to set via op run that cannot be set by the AWS shell plugin

Marton6 avatar Jan 06 '25 11:01 Marton6

Hello @npearson72 , It looks like you're using the Terraform plugin with a stable version of the CLI (2.30.3). However, please note that the Terraform plugin is currently only available in the beta versions of the CLI. The latest beta release is 2.30.0-beta.03. We recommend trying the command again using the beta version, which should allow the plugin to work as expected.

moward98 avatar Jan 06 '25 13:01 moward98

@Marton6 the contents of my .env files looks like:

TF_VAR_aws_account_id=op://infra/global/aws_account_id
TF_VAR_domain_name=op://infra/services_app_global/domain_name
TF_VAR_region=op://infra/global/region
TF_VAR_repository_name=op://infra/services_app_global/repository_name
TF_VAR_service_name=op://infra/services_app_global/service_name

@moward98 Thanks for the tip. I'll give it a try.

npearson72 avatar Jan 06 '25 16:01 npearson72