Skip to content

Commit

Permalink
Readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacerat committed Jul 29, 2019
1 parent 719998b commit 1658665
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
# Checked AWS Custom Resource

This is a wrapper around the AWS CDK's [AwsCustomResource](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_custom-resources.AwsCustomResource.html), which complains when you give it SDK services or actions which don't exist.
This is a wrapper around the AWS CDK's [AwsCustomResource](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_custom-resources.AwsCustomResource.html).

By default, if you specify an SDK function for `AwsCustomResource` which doens't exist, CDK will still generate a
CloudFormation template for you and attempt to deploy it, just to eventually fail.

This wrapper resolves that by complaining when you give it SDK services or actions which don't exist. The price is fairly small:
your CDK project will depend on `aws-sdk`.

To install

```
npm install --save checked-aws-custom-resource
```

For example, this is fine:
For example, this is fine.

```ts
new CheckedAwsCustomResource(stack, "Good", {
onCreate: {
service: "RDS",
action: "modifyDBCluster",
parameters: {},
parameters: {
DBClusterIdentifier: db.ref,
EnableHttpEndpoint: true
},
physicalResourceId: `resourceId`
}
});
```

but if you get the capitalization wrong, it will fail during instantiation.
Meanwhile, here the captilization of "ModifyDBCluster" is wrong, so
the class will throw an exception during instantiation:

```ts
new CheckedAwsCustomResource(stack, "Good", {
new CheckedAwsCustomResource(stack, "Bad", {
onCreate: {
service: "RDS",
action: "ModifyDBCluster",
parameters: {},
parameters: {
DBClusterIdentifier: db.ref,
EnableHttpEndpoint: true
},
physicalResourceId: `resourceId`
}
});
```

If this is in your Stack when you `synth` it, you'll see:
If this is in your Stack when you `cdk synth` it, you'll see a helpful error message.

```
$ cdk synth MyStack
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "checked-aws-custom-resource",
"version": "0.1.5",
"version": "0.1.6",
"main": "src/index.js",
"scripts": {
"test": "jest tests/test.ts",
Expand Down

0 comments on commit 1658665

Please sign in to comment.