Skip to content

Commit

Permalink
ypdate own stack
Browse files Browse the repository at this point in the history
  • Loading branch information
hex22a committed Mar 13, 2021
1 parent b7900ee commit ca9784b
Show file tree
Hide file tree
Showing 5 changed files with 5,889 additions and 1,180 deletions.
2 changes: 2 additions & 0 deletions .yarnrc.yml
@@ -1,5 +1,7 @@
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.js
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.js
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-berry.js
27 changes: 27 additions & 0 deletions lib/vpc.test.ts
@@ -0,0 +1,27 @@
import '@aws-cdk/assert/jest';
import { Stack } from "@aws-cdk/core";

import Motherbase from './vpc';

describe('VPC', () => {
describe('Motherbase', () => {
test('constructor', () => {
// Arrange
const stack = new Stack();
const expectedId = 'Motherbase';
// Act
new Motherbase(stack);
// Assert
const CLOUDFORMATION_VPC = 'AWS::EC2::VPC';
const CLOUDFORMATION_SUBNET = 'AWS::EC2::Subnet';
expect(stack).toHaveResource(CLOUDFORMATION_VPC, {
EnableDnsHostnames : true,
EnableDnsSupport : true
})
expect(stack).toHaveResource(CLOUDFORMATION_SUBNET, {
EnableDnsHostnames : true,
EnableDnsSupport : true
})
})
})
})
18 changes: 18 additions & 0 deletions lib/vpc.ts
@@ -0,0 +1,18 @@
import * as core from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';

class Motherbase extends ec2.Vpc {
constructor(scope: core.Construct) {
super(scope, 'Motherbase', {
enableDnsSupport: true,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ingress',
subnetType: ec2.SubnetType.PUBLIC,
}
]
});
}
}
export default Motherbase;
32 changes: 23 additions & 9 deletions package.json
Expand Up @@ -8,16 +8,30 @@
"cdk": "cdk"
},
"devDependencies": {
"@types/node": "^13.5.0",
"aws-cdk": "^1.22.0",
"ts-node": "^8.6.2",
"typescript": "^3.7.5"
"@aws-cdk/assert": "^1.72.0",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"aws-cdk": "^1.93.0",
"jest": "^26.6.3",
"ts-jest": "^26.4.3",
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
},
"dependencies": {
"@aws-cdk/aws-ec2": "^1.22.0",
"@aws-cdk/core": "^1.22.0",
"@types/js-base64": "^2.3.1",
"js-base64": "^2.5.2",
"source-map-support": "^0.5.16"
"@aws-cdk/assets": "^1.72.0",
"@aws-cdk/aws-ec2": "^1.72.0",
"@aws-cdk/core": "^1.72.0",
"@types/js-base64": "^3.0.0",
"js-base64": "^3.6.0",
"source-map-support": "^0.5.19"
},
"jest": {
"verbose": true,
"testMatch": [
"**/?(*.)(spec|test).ts?(x)"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
}
}
}

0 comments on commit ca9784b

Please sign in to comment.