Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatArn helper can't generate valid SQS queue ARNs #26958

Closed
adambiggs opened this issue Aug 31, 2023 · 6 comments
Closed

formatArn helper can't generate valid SQS queue ARNs #26958

adambiggs opened this issue Aug 31, 2023 · 6 comments
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@adambiggs
Copy link

Describe the bug

When using Stack.of(this).formatArn() it doesn't appear possible to generate valid SQS queue ARNs. Queue ARNs don't contain a resource type at all, and there's no arnFormat for this particular use case.

Expected Behavior

formatArn() should be able to generate valid SQS queue ARNs.

Current Behavior

The closest I can get is something like this:

Stack.of(this).formatArn({
  service: 'sqs',
  resource: '',
  resourceName: 'my-queue.fifo',
  arnFormat: ArnFormat.COLON_RESOURCE_NAME
})

Which outputs e.g. :sqs:us-east-1:000000000000::my-queue.fifo (note the double :: before the queue name).

The actual ARN is arn:aws:sqs:us-east-1:000000000000:my-queue.fifo.

Reproduction Steps

Same as above:

Stack.of(this).formatArn({
  service: 'sqs',
  resource: '',
  resourceName: 'my-queue.fifo',
  arnFormat: ArnFormat.COLON_RESOURCE_NAME
})

Possible Solution

Really I think the best solution would be to deprecate (or at least make optional) the arnFormat parameter, and have formatArn() automatically deal with this based on the value of service.

But at the very least there should be an arnFormat for this use case.

Additional Information/Context

No response

CDK CLI Version

2.92.0 (build bf62e55)

Framework Version

No response

Node.js Version

16

OS

MacOS

Language

Typescript

Language Version

4.9.5

Other information

No response

@adambiggs adambiggs added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 31, 2023
@github-actions github-actions bot added the @aws-cdk/aws-sqs Related to Amazon Simple Queue Service label Aug 31, 2023
@peterwoodworth
Copy link
Contributor

peterwoodworth commented Aug 31, 2023

This works

    const arn = this.formatArn({
      service: 'sqs',
      resource: 'myqueuename',
    })

    new cdk.CfnOutput(this, 'QueueArn', { value: arn })

OutputStack.QueueArn = arn:aws:sqs:us-east-1:123456789012:myqueuename

@peterwoodworth
Copy link
Contributor

The docstring for resource states:

Resource type (e.g. "table", "autoScalingGroup", "certificate"). For some resource types, e.g. S3 buckets, this field defines the bucket name.

Could this be made more clear somehow?

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Aug 31, 2023
@github-actions
Copy link

github-actions bot commented Sep 3, 2023

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 3, 2023
@adambiggs
Copy link
Author

adambiggs commented Sep 5, 2023

This could definitely be made more clear by documenting how ARNs are structured for all services in a central place.

Or better yet, update formatArn or create a new helper that takes the cognitive load away from the user and just does the work. I would love to not have to think about this.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Sep 6, 2023
@peterwoodworth
Copy link
Contributor

This could definitely be made more clear by documenting how ARNs are structured for all services in a central place.

I'm not super sure what you mean by this exactly

Or better yet, update formatArn or create a new helper that takes the cognitive load away from the user and just does the work. I would love to not have to think about this.

If you have an idea of how the user contract for this could improve, feel free to create a feature request with a proposed solution 🙂

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 6, 2023
@github-actions
Copy link

github-actions bot commented Sep 8, 2023

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants