1.7.0 • Published 1 month ago

cloudformation-resources v1.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

CloudFormation Resource Identifiers

I was tired of passing string values as CDK resource type identifiers in my TypeScript projects, so I scraped AWS's docs and built a class-based typeset of (a handful of) identifiers.

We have a type system; we can do better. Except for the project name: that bit remains completely terrible.

Installation

npm

npm i --save-dev cloudformation-resources

Yarn

yarn add --dev cloudformation-resources

Usage

In your CDK TypeScript files:

import { Template } from "aws-cdk-lib/assertions";
import { AWS } from "cloudformation-resources";

const app = newApp("dev");
const stack = new VpcStack(app, "vpc-stack", {});

const template = Template.fromStack(stack);
template.resourceCountIs(AWS.EC2.VPC, 1); // instead of the wholly-gnarly "AWS::EC2::VPC"

Alternatively, you can import just the service set:

import { EC2 } from "cloudformation-resources/ec2";

const app = newApp("dev");
const stack = new VpcStack(app, "vpc-stack", {});

const template = Template.fromStack(stack);
template.resourceCountIs(EC2.VPC, 1);

Building Typesets

Building (or re-building) the identifier sets requires Deno. To scrape the AWS docs and generate the TypeScript files, run:

deno run --allow-net --allow-write --allow-read scripts/scrape-identifiers.ts

Contributing

Pull requests are welcome. To add services, add them to servicePages in scripts/scrape-identifiers.ts, then run the build command.

!IMPORTANT Be sure to run deno fmt before committing to ensure consistent formatting.

1.7.0

1 month ago

1.6.0

7 months ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago