-
Notifications
You must be signed in to change notification settings - Fork 5
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
Escape double-colons (::) #85
Conversation
… so the resource URNs are compatible with Pulumi's format
PR is now waiting for a maintainer to run the acceptance tests. This PR will only perform build and linting. |
Hi @karakter98. Thanks for the PR! It would be really helpful if you could post an example of what works with this change, but didn't work without it. A quick test would be even better. |
/run-acceptance-tests |
Please view the PR build - https://github.com/pulumi/pulumi-cdk/actions/runs/6005610699 |
@iwahbe I tried to write a test, but it seems the pulumi runtime isn't actually called to register the resource, so the URN error never shows up in the test file. I believe it's because of the mocks, but I'm not familiar enough with the codebase to figure it out further. What we can do now and couldn't do before: register custom resources from CDK that contain |
A quick example: const bucket = new Bucket(this, "Bucket", {
enforceSSL: true,
removalPolicy: RemovalPolicy.DESTROY,
autoDeleteObjects: true,
});
new BucketDeployment(this, "Deployment", {
sources: [Source.asset(path.join("..", "build", "web"))],
destinationBucket: bucket,
retainOnDelete: false,
}); Both the |
Thanks for the example @karakter98. I have asked someone familiar with pulumi-ckd to take a look at your PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karakter98 Thanks for this PR!
A quick example
Do you have this example running end-to-end after these changes? I'd love to include a test that locks in the correct functionality for these cases.
It would also be great to pull this replacement logic out into a function - perhaps urnEncode
.
I do also slightly wonder if we want to do a different URN encoding that (a) is reversible and (b) is more certain to avoid ::
. The current replacement isn't reversile because you can't be sure :
should be :
or ::
. And also doesn't strictly speaking avoid ::
, as ::::
would still turn into ::
. It's uglier, but perhaps sending :
to %3A
might be more reliable.
Technically, this is also a breaking change, but I think given that it would always have errored previously, there was no working code that this can break. In the future, if we want to change this encoding pattern, we can likely use aliases to support the current pattern - so the decision on the replacement is not a one-way door.
@lukehoban Yes, I'm currently using this to deploy the frontend for a new project, so I can confirm it allows the use of custom resources. The actual complete example is a bit complicated, because it uses:
I think it makes sense to split this into multiple PRs, because so much setup is needed on the user side that the test code would be pretty huge. I'll test out your suggestion with |
Got it. Yeah - I tried out the original example and ran into all those same problems as well. I’ll open some issues to track the remaining things we’ll need to address here. If you already have PRs in progress, great! |
PR is now waiting for a maintainer to run the acceptance tests. This PR will only perform build and linting. |
@lukehoban I changed the encoding according to your feedback, can confirm Pulumi registers the names correctly with the |
/run-acceptance-tests |
Please view the PR build - https://github.com/pulumi/pulumi-cdk/actions/runs/6051638879 |
Is this fine to be merged? I already opened other PRs and am ready to start working on the dynamic provider PR for custom resources, but this needs to be merged first |
@lukehoban could you take a look when you get some time? |
PR is now waiting for a maintainer to run the acceptance tests. This PR will only perform build and linting. |
@karakter98 we have added support for custom resources in #190 |
Escape double-colons (::) from AWS custom resource naming convention, so the resource URNs are compatible with Pulumi's format.
Allows users to define their own dynamic providers for custom resources, which partially solves #60.
With these minimal changes, I was able to implement a generic dynamic provider for custom resources, which seems to work fine for S3BucketDeployment and S3AutoDeleteObjects resources. I'll brush it up a bit and will open another PR.