Modularize the AWS proof of concept stacks

And get them building.  Mostly.
This commit is contained in:
joeduffy 2016-12-12 15:35:56 -08:00
parent 5f647b6cc0
commit 3c082ce20e
12 changed files with 73 additions and 8 deletions

2
lib/aws/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
bin/

4
lib/aws/Mu.yaml Normal file
View file

@ -0,0 +1,4 @@
name: aws
description: A collection of AWS resources as Mu stacks.
index: index.ts

10
lib/aws/ec2/index.ts Normal file
View file

@ -0,0 +1,10 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
export * from './internetGateway';
export * from './route';
export * from './routeTable';
export * from './securityGroup';
export * from './subnet';
export * from './vpc';
export * from './vpcGatewayAttachment';

View file

@ -1,7 +1,9 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as mu from 'mu';
import * as aws from 'aws';
// An Internet gateway enables your instances to connect to the Internet through the Amazon EC2 edge network.a
// An Internet gateway enables your instances to connect to the Internet through the Amazon EC2 edge network.
// @name: aws/ec2/internetGateway
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internet-gateway.html
export default class InternetGateway extends aws.cloudformation.Resource {
@ -9,7 +11,7 @@ export default class InternetGateway extends aws.cloudformation.Resource {
super(ctx, {
resource: "AWS::EC2::InternetGateway",
properties: {
tags: aws.tagsPlusName(tags, args.name),
tags: aws.tagsPlusName(args.tags, args.name),
},
});
}

View file

@ -1,3 +1,5 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as mu from 'mu';
import * as aws from 'aws';

View file

@ -1,3 +1,5 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as mu from 'mu';
import * as aws from 'aws';
@ -11,7 +13,7 @@ export class RouteTable extends aws.cloudformation.Resource {
resource: "AWS::EC2::RouteTable",
properties: {
vpcId: args.vpc,
tags: aws.tagsPlusName(tags, args.name),
tags: aws.tagsPlusName(args.tags, args.name),
},
});
}

View file

@ -1,3 +1,5 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as mu from 'mu';
import * as aws from 'aws';
@ -13,7 +15,7 @@ export class SecurityGroup extends aws.cloudformation.Resource {
vpcId: args.vpc,
securityGroupEgress: args.securityGroupEgress,
securityGroupIngress: args.securityGroupIngress,
tags: aws.tagsPlusName(tags, args.name),
tags: aws.tagsPlusName(args.tags, args.name),
},
});
}

View file

@ -1,3 +1,5 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as mu from 'mu';
import * as aws from 'aws';
@ -13,13 +15,13 @@ export class Subnet extends aws.cloudformation.Resource {
vpcId: args.vpc,
availabilityZone: args.availabilityZone,
mapPublicIpOnLaunch: args.mapPublicIpOnLaunch,
tags: aws.tagsPlusName(tags, args.name),
tags: aws.tagsPlusName(args.tags, args.name),
},
});
}
}
export interface RouteTableArgs {
export interface SubnetArgs {
// The CIDR block that you want the subnet to cover (for example, `"10.0.0.0/24"`).
readonly cidrBlock: string;
// The VPC on which you want to create the subnet.

View file

@ -1,3 +1,5 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as mu from 'mu';
import * as aws from 'aws';
@ -13,7 +15,7 @@ export class VPC extends aws.cloudformation.Resource {
instanceTenancy: args.instanceTenancy,
enableDnsSupport: args.enableDnsSupport,
enableDnsHostnames: args.enableDnsHostnames,
tags: aws.tagsPlusName(tags, args.name),
tags: aws.tagsPlusName(args.tags, args.name),
},
});
}
@ -39,5 +41,5 @@ export interface VPCArgs {
tags?: aws.Tag[];
}
type VPCInstanceTenancy = "default" | "dedicated";
export type VPCInstanceTenancy = "default" | "dedicated";

View file

@ -1,3 +1,5 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as mu from 'mu';
import * as aws from 'aws';

5
lib/aws/index.ts Normal file
View file

@ -0,0 +1,5 @@
// Copyright 2016 Marapongo, Inc. All rights reserved.
import * as ec2 from './ec2';
export { ec2 };

30
lib/aws/tsconfig.json Normal file
View file

@ -0,0 +1,30 @@
{
"compilerOptions": {
"outDir": "bin",
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"stripInternal": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true
},
"files": [
"index.ts",
"ec2/index.ts",
"ec2/internetGateway.ts",
"ec2/route.ts",
"ec2/routeTable.ts",
"ec2/securityGroup.ts",
"ec2/subnet.ts",
"ec2/vpc.ts",
"ec2/vpcGatewayAttachment.ts"
]
}