Skip to content
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

Create aws ccapi resources by using the SDK #217

Merged
merged 2 commits into from
Nov 14, 2024
Merged

Conversation

corymhall
Copy link
Contributor

This PR updates our mapping to create resources using the SDK directly
instead of creating a pulumi.CustomResource. By using a
pulumi.CustomResource we were missing out on all the resource specific
things from the generated SDK. (replaceOnChanges, required property
validation, etc).

closes #216

This PR updates our mapping to create resources using the SDK directly
instead of creating a `pulumi.CustomResource`. By using a
`pulumi.CustomResource` we were missing out on all the resource specific
things from the generated SDK. (`replaceOnChanges`, required property
validation, etc).

closes #216
@@ -114,6 +114,7 @@ describe('App Converter', () => {
examplebucketPolicyE09B485E: {
Type: 'AWS::S3::BucketPolicy',
Properties: {
PolicyDocument: {},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These updates to the tests are required because it now validates required properties.

@corymhall corymhall self-assigned this Nov 13, 2024
Copy link
Contributor

@flostadler flostadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

const mName = moduleName(typeName).toLowerCase();
const pType = pulumiTypeName(typeName);
const awsModule = aws as any;
return new awsModule[mName][pType](logicalId, props, options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!
This only works for resources that are nested in a module. Which is fine as there's only the ExtensionResource on the root level, which we do not use, and all CFN resources are nested in a module!

@corymhall corymhall merged commit 87f3755 into main Nov 14, 2024
13 checks passed
@corymhall corymhall deleted the corymhall/ccapi-resource branch November 14, 2024 12:59
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS CCAPI resources should be invoked from the SDK
3 participants