Replies: 1 comment 2 replies
-
Hi @egriffith You can create a correct SQS Arn like this: const QueueArn = cdk.Arn.format(
{
arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME,
region: "us-east-1",
service: "sqs",
account: "111122223333",
resource: "AutoAckQueue-gamma",
},
this
); This results in the correct format: PS: I've converted this to a discussion topic, since it appears to be more of a question. Please let me know if you disagree. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
It does not appear to actually be possible to craft an SQS queue arn using the available formatters in aws-cdk-lib.Arn.format() and aws-cdk-lib.ArnFormat.
The docs define an SQS queue arn as being:
Notice that there is no resource-type name and the separator between account id and the resource itself is -exclusively- a colon.
I'm using the following TypeScript snippet:
This arn then gets used to craft an IAM policy. The resulting IAM policy however ends up looking like this..
Note that there is a leading slash inserted before the resource identifier.
I see two problems with the current behavior.
aws-cdk-lib.Arn.Format() does not accept a "sep" argument where we could override that "sep" should be a "" rather than "/"
aws-cdk-lib.Arn.Format() has "resource" as a mandatory argument while most other arguments are optional, despite the fact that there are ARNs which do not include a resource name.
Expected Behavior
A leading slash should not be forcible inserted prior to the queue name at a minimum.
Current Behavior
A leading slash IS forcibly inserted prior to the queue name, and an argument that should be optional is required.
Reproduction Steps
See above code snippet
Possible Solution
Include an optional "sep" argument to aws-cdk-lib.Arn.format() that allows for overriding sep="/" with sep = ""
Additional Information/Context
No response
CDK CLI Version
2.27.0
Framework Version
No response
Node.js Version
NodeJS 14.x
OS
Amazon Linux 2
Language
Typescript
Language Version
No response
Other information
No response
Beta Was this translation helpful? Give feedback.
All reactions