beatlabs/patron

Add AWS Queue Owner Account ID for SQS

erifili117 opened this issue · 1 comments

Is your feature request related to a problem? Please describe

When creating a new SQS consumer component, Patron currently does not allow to set the QueueOwnerAWSAccountId attribute on the GetQueueUrlWithContext call.

Is this a bug? Please provide steps to reproduce, a failing test etc.

This becomes an issue, when trying to connect to SQS, with a role that belongs to a different account than the one SQS belongs to, since Amazon needs the owner in order to connect.

Steps to reproduce:

  • Set up Role A on Amazon Account A
  • Set up SQS on Amazon Account B
  • Set up a Patron service which has the Role A
  • Give permissions for Role A to be able to access SQS
  • Try to create a new SQS component with patron
  • GetQueueUrlWithContext returns error

Describe the solution

Instead of only supporting:

out, err := sqsAPI.GetQueueUrlWithContext(context.Background(), &sqs.GetQueueUrlInput{
QueueName: aws.String(queueName),
})

we should also allow for:

out, err := sqsAPI.GetQueueUrlWithContext(context.Background(), &sqs.GetQueueUrlInput{
    QueueName: aws.String(queueName),
    QueueOwnerAWSAccountId: aws.String(queueOwner),
})

We need to find a way to add an optional argument in the component function.