Reputation: 17
I am creating a new iam.PolicyDocument and attach this to an CfnQueue SQS that I have created. But I couldn't find a way to add Id to the access policy. Here is my Policy document and I would like to add Id to the policy so I can see as in the screenshot in aws console but I don't know how to add this. I am using Typescript and aws cdk v2
addFifoQueueResources(queueName: string, isFifo: boolean, iscontentBasedDeduplication: boolean, accountId: any, region: any) {
const cfnQueue = new sqs.CfnQueue(this, queueName, {
queueName: queueName,
fifoQueue: isFifo,
delaySeconds:0,
contentBasedDeduplication: iscontentBasedDeduplication,
maximumMessageSize: 262144,
messageRetentionPeriod:345600,
receiveMessageWaitTimeSeconds:0,
visibilityTimeout: 30
});
const customPolicyDocument = new iam.PolicyDocument({
**//I would like to add Id: sqspolicy-${queueName} here**
statements: [
new iam.PolicyStatement({
actions: ['SQS:*'],
effect: iam.Effect.ALLOW,
sid: `Sid-${queueName}`,
principals: [
new iam.ArnPrincipal(`arn:aws:iam::${accountId}:root`)
],
resources: [
`arn:aws:sqs:${region}:${accountId}:${queueName}`
]
})
]
});
new sqs.CfnQueuePolicy(this, 'customPolicyDocument', {
queues: [cfnQueue.attrQueueUrl],
policyDocument: customPolicyDocument.toJSON()});}
Upvotes: 0
Views: 935
Reputation: 1554
It seems, they do not support the id
for it, at the moment
More info here: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyDocumentProps.html
Upvotes: 1