pulumi/pulumi-cdk

Missing `aws-native:sqs:QueuePolicy`

sam-goodwin opened this issue · 5 comments

What happened?

The AWS::SQS::QueuePolicy is missing.

Expected Behavior

When using the QueuePolicy Resource, the application should deploy without fail.

Steps to reproduce

Create a Queue and grant another Resource access. This should result in a QueuePolicy Resource being created with a Policy.

Output of pulumi about

CLI
Version      3.53.1
Go Version   go1.19.5
Go Compiler  gc

Plugins
NAME    VERSION
aws     5.28.0
nodejs  unknown

Host
OS       darwin
Version  13.1
Arch     arm64

This project is written in nodejs: executable='/Users/samgoodwin/.nvm/versions/node/v16.14.2/bin/node' version='v16.14.2'

Current Stack: sam-g/stock-bot/stock-bot

TYPE                 URN
pulumi:pulumi:Stack  urn:pulumi:stock-bot::stock-bot::pulumi:pulumi:Stack::stock-bot-stock-bot


Found no pending operations associated with stock-bot

Backend
Name           pulumi.com
URL            https://app.pulumi.com/sam-g
User           sam-g
Organizations  sam-g

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

When mapping this one, the Pulumi classic QueuePolicy resource only accepts a single queueUrl while the CFN Resource passes an array.

My only course of action is to create multiple QueuePolicy resources? Problem is I am expected to return a Resource from the mapping function.

Should I create a ComponentResource to encapsulate them?

const comp = new ComponentResource(
  "AWS::SQS::QueuePolicy",
  name,
  {},
  options
);

props.Queues.map(
  (queueUrl) =>
    new sqs.QueuePolicy(
      name,
      {
        policy: toJson(props.PolicyDocument),
        queueUrl,
      },
      {
        parent: comp,
      }
    )
);
return comp;

I've left a comment here which is applicable to this issue:

#66 (comment)

Re: creating multiple queue resources, @pgavlin could you take a look at that?

Should I create a ComponentResource to encapsulate them?

Yes, I think that's a reasonable path forwards. It's been a while since I had my nose in this code, so I can't recall for certain, but you may need to make sure that the component resource has appropriate public properties s.t. attribute mappings work properly.

Closing this since aws-native:sqs:QueuePolicy is available in the latest version of @pulumi/aws-native (v0.107.0)