aws-sso-cli icon indicating copy to clipboard operation
aws-sso-cli copied to clipboard

Ignore env vars for nested executions.

Open monwolf opened this issue 1 year ago • 1 comments

Hi! I'm using aws-sso with helm to access a s3 chart repo, and aws-sso for connecting EKS.

So I have to run helm with the env AWS_ACCESS_KEY_ID and it calls aws-sso for doing eks login. I'm using a kube config global with this configuration for the login:

- name: arn:aws:eks:eu-west-1:xxxx:cluster/xx-devops-xxx-cluster
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - exec
      - -A
      - "xxxxxx"
      - --role=AdministratorAccess
      - aws
      - eks
      - get-token
      - --cluster-name
      - ae-devops-eks-cluster
      command: aws-sso
      env: null
      interactiveMode: IfAvailable
      provideClusterInfo: false

So when helm run its it shows the error:

error="Conflicting environment variable 'AWS_ACCESS_KEY_ID' is set"

I tried to empty the env var as follows:

      - name: AWS_ACCESS_KEY_ID
        value:

But the same error happens.

How would you be able to solve this? Is there any way to ignore the env vars without doing a wrapper for this command?

monwolf avatar Nov 06 '24 09:11 monwolf

Just to be clear, you want to override the existing AWS credentials in the shell ENV? Definitely could add a flag to force the override of the existing ENV vars. Frankly I didn't allow it because people get confused what the order the AWS SDK will select the credentials (AWS_PROFILE vs. AWS_ACCESS_KEY_ID vs. assigned role via EC2, etc...)

synfinatic avatar May 17 '25 19:05 synfinatic