concourse / concourse/docker-image-resource

Push to ECR ignoring provided AWS creds, assuming IAM role instead

Open
#291 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-investigation
Dominant language
Go
Stars
162
Forks
250
PR merge metrics
No merged PRs in 30d

Description

I have Concourse setup in an Amazon EKS (k8s) cluster. The cluster has an IAM role that provides it to access a restricted set of resources needed to maintain the cluster.

Concourse is additionally seeded with a specific Concourse IAM user (via secret_access_key and access_key_id) that has access to ECR.

When I use that IAM user to push to ECR, I get a denied and not authorized to perform error. Weirdly, the role the error message references is the assumed IAM role of the cluster, and not the Concourse user of the secret_access_key and access_key_id that I passed to the docker-image resource.

My resource configuration:

  - name: ecr-docker-reg
    type: docker-image
    source:
      access_key_id: ((aws-access-key-id-dev))
      secret_access_key: ((aws-secret-access-key-dev))
      repository: <ECR_REPO_URL_HERE>

I get the following output:

Successfully tagged <IMAGE_NAME>
18:13:35
The push refers to repository [<ECR_REPO_URL_HERE]
18:13:35
82dcad63e746: Preparing
18:13:35
a4c502aa9e69: Preparing
18:13:35
8137f1ad3edc: Preparing
18:13:35
beee9f30bc1f: Preparing
18:13:35
beee9f30bc1f: Waiting
18:13:35
denied: User: arn:aws:sts::<some-assumed-cluster-role> is not authorized to perform: ecr:InitiateLayerUpload on resource: arn:aws:ecr:us-west-2:<ECR_REPO_URL>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the docker-image resource's handling of the provided access_key_id and secret_access_key, then trace the ECR push entry point to determine why the cluster's assumed role is used instead. Reproduce the push with the resource configuration shown; done means the ECR operation uses the supplied Concourse credentials and no longer reports the cluster role.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, go
Domain
cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.