pulumi/pulumi-cdk

Support BucketDeployment

PeterWhiteCL opened this issue · 4 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

I'm trying use CDK v2 to deploy files to a bucket via "aws-cdk-lib/aws-s3-deployment" and using BucketDeployment, but the resource type is Custom::CDKBucketDeployment and there is no direct mapping to it for Cloud Control API (https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html). Even with manual mapping, it doesn't really seem to work.Looking for a fix or workaround Peter WhiteAug 10, 2022, 05:02 PDTm trying use CDK v2 to deploy files to a bucket via "aws-cdk-lib/aws-s3-deployment" and using BucketDeployment, but the resource type is Custom::CDKBucketDeployment and there is no direct mapping to it for Cloud Control API (https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html). Even with manual mapping, it doesn't really seem to work .Looking for a fix or workaround
We are trying use CDK v2 to deploy files to a bucket via "aws-cdk-lib/aws-s3-deployment" and using BucketDeployment, but the resource type is Custom::CDKBucketDeployment and there is no direct mapping to it for Cloud Control API (https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html). Even with manual mapping, it doesn't really seem to work.Looking for a fix or workaround

This is for an article commissioned by Pulumi. I have attached a link to a repository containing the code for the project from our author.

Affected area/feature

pulumi-cdk-static.zip

t0yv0 commented

@PeterWhiteCL we use the GitHub issues for enhancement requests and/or bug reports against Pulumi components. Could you clarify if this request is one of those? Is Pulumi missing support for a Bucket Deployment?

We don’t currently have support for the custom resources BucketDeployment creates and uses.

We will likely need to polyfill this with a Pulumi-native solution.

In the meantime, users can polyfill themselves via use of https://github.com/pulumi/pulumi-cdk#remapcloudcontrolresource.

@lukehoban I've been experimenting with CDK Custom Resources support this weekend. It's doable, but the Clouformation naming convention of "Custom::ExampleResource" is clashing with Pulumi's URN format. When the double colons (::) are in the Pulumi resource name, it throws an "invalid URN format".

I got around this by directly changing this line from interop.ts:

super(cdk:construct:${constructType}, constructName, {}, options);
to
super(cdk:construct:${constructType}.replace("::", ":"), constructName.replace("::", ":"), {}, options);

With this change, Pulumi doesn't throw the "invalid URN" error.

I realize this is just a "hack" and there's probably a better way to do it, but it's enough to confirm where the issue is.

@robert-databooster great to hear! Yes - sounds like we’ll need to escape the constructType and constructName given that CF naming requirements are different than Pulumi naming. I think the proposed transform makes sense. Can review more closely if you have a PR ready for this.