-
Notifications
You must be signed in to change notification settings - Fork 5
Create Particles for Route 53 #90
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
Open
jophine-antony
wants to merge
4
commits into
develop
Choose a base branch
from
CE-212-route53
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7c2ae15
Create Particles for Route 53
jophine-antony 8ef2eec
Moved resources out of cftemplates and added to resources directory a…
jophine-antony 745cad7
Addressed review comments. Moved resources to resources directory.
jophine-antony 10ba659
Changes:
jophine-antony File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
|
|
||
| ifdef ACCOUNTS | ||
| else | ||
| ACCOUNTS := 442294194136 | ||
| endif | ||
|
|
||
| TEST := false | ||
|
|
||
| ifdef AWS_REGION | ||
| else | ||
| AWS_REGION := us-east-1 | ||
| endif | ||
|
|
||
| build: setup | ||
|
|
||
| buildlambda: upload update | ||
|
|
||
| upload: | ||
| npm install | ||
| cd build.f; node run_upload_code; | ||
|
|
||
| update: | ||
| npm install | ||
| cd build.f; node run_update_code; | ||
|
|
||
| setup: | ||
| cd build.f/particles-initial; npm install; ./node_modules/.bin/gulp condensation:build; ./node_modules/.bin/gulp condensation:deploy; | ||
|
|
||
| clean: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
|
|
||
| # Route53 | ||
|
|
||
| AWS micro service to Manage AWS Route53. | ||
|
|
||
|
|
||
| ## How To Setup | ||
|
|
||
| $ make \ | ||
| -e AWS_REGION=<region> \ | ||
| -e ACCOUNTS="<accounts whose config policy will be monitored separated by spaces>" | ||
|
|
||
|
|
||
| ## How To Update Lambda Function Codes | ||
|
|
||
| $ make buildlambda | ||
|
|
||
|
|
||
| ## How To Remove Service | ||
|
|
||
| $ make clean -e AWS_REGION=<region> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| condensation_errors | ||
| config/local.js | ||
| dist | ||
| node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| var git = require('gulp-git'), | ||
| gulp = require('gulp'), | ||
| vfs = require('vinyl-fs'), | ||
| zip = require('gulp-zip'), | ||
| exec = require('child_process').exec; | ||
|
|
||
| module.exports.initialize = function(cb) { | ||
| var child = exec('npm install', function(error, stdout, stderr) { | ||
| if (error) return cb(error); | ||
| }); | ||
|
|
||
| vfs.src(["managed-route53/index_*.js", "managed-route53/json/*.json", "lib/flow_controller.js", "lib/aws/*.js"],{cwd:'../../..', base:'../../..'}) | ||
| .pipe(zip('managed-route53.zip')) | ||
| .pipe(gulp.dest('./particles/assets')) | ||
| .on('end', function(err, data) { | ||
| vfs.src(['cloudformation/*.js'],{cwd:'../../..', base:'../../..'}) | ||
| .pipe(zip('cloudformation_builder.zip')) | ||
| .pipe(gulp.dest('./particles/assets')) | ||
| .on('end', cb); | ||
| }); | ||
| }; |
16 changes: 16 additions & 0 deletions
16
managed-route53/build.f/particles-initial/config/default.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var config = { | ||
| s3: [ | ||
| { | ||
| aws: { | ||
| region: 'us-east-1', | ||
| bucket: 'sgas.particles-managed-route53.442294194136.us-east-1' | ||
| }, | ||
| clean: true, | ||
| validate: true, | ||
| create: true | ||
| } | ||
| ], | ||
| dist: 'dist' | ||
| }; | ||
|
|
||
| module.exports = config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| var gulp = require('gulp'), | ||
| config = require('config'); | ||
|
|
||
| // Will add necessary gulp tasks to build, compile and validate | ||
| // CloudFormation templates | ||
|
|
||
| require('condensation').buildTasks(gulp,config); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "name": "managed-route53", | ||
| "version": "0.0.1", | ||
| "description": "Condensation particles for building AWS Route53 CloudFormation templates.", | ||
| "scripts": { | ||
| "test": "./node_modules/.bin/mocha", | ||
| "build": "./node_modules/.bin/gulp condensation:build", | ||
| "deploy": "./node_modules/.bin/gulp condensation:deploy", | ||
| "gulp": "./node_modules/.bin/gulp" | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "keywords": [ | ||
| "condensation-particles", | ||
| "aws", | ||
| "cloudformation", | ||
| "cloud", | ||
| "formation", | ||
| "aws", | ||
| "vpc" | ||
| ], | ||
| "dependencies": { | ||
| "condensation": "^0.5.5", | ||
| "config": "^1.21.0", | ||
| "gulp": "^3.9.1", | ||
| "particles-core": "^0.4.5", | ||
| "particles-vpc": "^0.5.1", | ||
| "particles-nat-gateway": "^0.2.2" | ||
| }, | ||
| "devDependencies": { | ||
| "condensation-particle-tests": "^0.5.2", | ||
| "mocha": "^2.5.3" | ||
| } | ||
| } |
4 changes: 4 additions & 0 deletions
4
managed-route53/build.f/particles-initial/particles/cftemplates/route53HostedZone.json.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| {{#layout templateDescription="This template creates Route53 Hosted Zone"}} | ||
| {{set "hostedzone"}} | ||
|
|
||
| {{/layout}} |
4 changes: 4 additions & 0 deletions
4
managed-route53/build.f/particles-initial/particles/cftemplates/route53RecordSet.json.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| {{#layout templateDescription="This template creates Route53 Record Set"}} | ||
|
|
||
| {{set "recordset"}} | ||
| {{/layout}} |
8 changes: 8 additions & 0 deletions
8
managed-route53/build.f/particles-initial/particles/parameters/optionalString.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| description: "Optional input for Route53" | ||
| --- | ||
| {{ | ||
| parameter "m:core" "base" | ||
| type="String" | ||
| optional=true | ||
| }} |
7 changes: 7 additions & 0 deletions
7
managed-route53/build.f/particles-initial/particles/parameters/requiredString.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| description: "Required input for Route53" | ||
| --- | ||
| {{ | ||
| parameter "m:core" "base" | ||
| type="String" | ||
| }} |
6 changes: 6 additions & 0 deletions
6
managed-route53/build.f/particles-initial/particles/resources/route53HostedZone.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{#resource "m:core" "base" type="AWS::Route53::HostedZone"}} | ||
| {{#helper "m:core" "properties"}} | ||
| {{helper "m:core" "property" "Name"}} | ||
| {{helper "m:core" "property" "Comment" optional=true}} | ||
| {{/helper}} | ||
| {{/resource}} |
9 changes: 9 additions & 0 deletions
9
managed-route53/build.f/particles-initial/particles/resources/route53RecordSet.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| {{#resource "m:core" "base" type="AWS::Route53::RecordSet"}} | ||
| {{#helper "m:core" "properties"}} | ||
| {{helper "m:core" "property" "HostedZoneId"}} | ||
| {{helper "m:core" "property" "Name"}} | ||
| {{helper "m:core" "property" "Type"}} | ||
| {{helper "m:core" "property" "TTL"}} | ||
| {{helper "m:core" "property" "ResourceRecords"}} | ||
| {{/helper}} | ||
| {{/resource}} |
13 changes: 13 additions & 0 deletions
13
managed-route53/build.f/particles-initial/particles/sets/hostedzone.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| {{parameter "requiredString" logicalId="RouteHostName"}} | ||
| {{parameter "optionalString" logicalId="RouteHostComment"}} | ||
|
|
||
| {{#resource "route53HostedZone" logicalId="Route53HostedZone" }} | ||
| "Properties": { | ||
| "Name": {{ref "RouteHostName"}}, | ||
| "HostedZoneConfig": { | ||
| "Comment": {{ref "RouteHostComment"}} | ||
| } | ||
| } | ||
| {{/resource}} | ||
|
|
||
| {{output "m:core" "base" logicalId="Route53HostZoneID" value=(ref "Route53HostedZone")}} |
19 changes: 19 additions & 0 deletions
19
managed-route53/build.f/particles-initial/particles/sets/recordset.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {{parameter "requiredString" logicalId="HostedZoneId" description="Hosted Zone Id"}} | ||
| {{parameter "requiredString" logicalId="RecordSetName" description="Name of Record Set"}} | ||
| {{parameter "requiredString" logicalId="RecordSetType" description="Type of Record Set, eg: A, CNAME, MX, AAAA, TXT, PTR, SRV, SPF, NAPTR"}} | ||
| {{parameter "requiredString" logicalId="ResourceRecord" description="Value for the record set"}} | ||
| {{parameter "requiredString" logicalId="TTLValue" description="TTL in seconds"}} | ||
| {{parameter "requiredString" logicalId="ResourceRecord" description="Value for Record Set Type" type="CommaDelimitedList"}} | ||
|
|
||
| {{#resource logicalId="Route53RecordSet"}} | ||
| "Type": "AWS::Route53::RecordSet", | ||
| "Properties": { | ||
| "HostedZoneId": {{ref "HostedZoneId"}}, | ||
| "Name": {{ref "RecordSetName"}}, | ||
| "Type": {{ref "RecordSetType"}}, | ||
| "TTL": {{ref "TTLValue"}}, | ||
| "ResourceRecords": {{ref "ResourceRecord"}} | ||
| } | ||
| {{/resource}} | ||
|
|
||
| {{output "m:core" "base" logicalId="Route53RecordSetDomainName" value=(ref "Route53RecordSet")}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
|
|
||
| var argv = require('minimist')(process.argv.slice(2)); | ||
| var action = argv._[0]; | ||
| var region = argv['region']; | ||
| var name = argv['name']; | ||
| var particles = argv['particles']; | ||
| if (!region || !action || (action != 'launch' && action != 'drop') || !name) { | ||
| console.log("Usage : node run_stack launch/drop --region <region> --name <stack name> [--parameters <parameter json str>] [--particles <particles folder name without 'particles-'>]"); | ||
| return; | ||
| } | ||
| console.log('action = ' + action); | ||
| console.log('region = ' + region); | ||
| console.log('name = ' + name); | ||
| console.log('particles Folder = ' + particles); | ||
|
|
||
| var templateStr = null; | ||
| if (particles) { | ||
| var fs = require("fs"); | ||
| templateStr = fs.readFileSync(__dirname + '/particles-' + particles + "/dist/0/particles/cftemplates/template.json", {encoding:'utf8'}); | ||
| } | ||
| var input = { | ||
| region: region, | ||
| stackName: name | ||
| } | ||
| if (templateStr) input.templateStr = templateStr; | ||
| console.log(input); | ||
|
|
||
| var stack_builder = new (require('../../lib/stack_builder'))(); | ||
| stack_builder[action](input, function(err, data) { | ||
| if(err) { | ||
| if (action == 'launch') { | ||
| console.log("Error occurred during " + action + " : " + err); | ||
| process.exit(1); | ||
| } | ||
| else if (action == 'drop') { | ||
| console.log("stack was already removed"); | ||
| process.exit(0); | ||
| } | ||
| } | ||
| else if(data) { | ||
| console.log("Successfully completed to " + action + " stack"); | ||
| process.exit(0); | ||
| } | ||
| else { | ||
| console.log("Failed to " + action + " stack"); | ||
| process.exit(1); | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "name": "managed-route53", | ||
| "version": "0.0.1", | ||
| "description": "Condensation particles for building AWS Route53 CloudFormation templates.", | ||
| "scripts": { | ||
| "test": "./node_modules/.bin/mocha", | ||
| "build": "./node_modules/.bin/gulp condensation:build", | ||
| "deploy": "./node_modules/.bin/gulp condensation:deploy", | ||
| "gulp": "./node_modules/.bin/gulp" | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "keywords": [ | ||
| "condensation-particles", | ||
| "aws", | ||
| "cloudformation", | ||
| "cloud", | ||
| "formation", | ||
| "aws", | ||
| "vpc" | ||
| ], | ||
| "dependencies": { | ||
| "condensation": "^0.5.5", | ||
| "config": "^1.21.0", | ||
| "gulp": "^3.9.1", | ||
| "particles-core": "^0.4.5", | ||
| "particles-vpc": "^0.5.1", | ||
| "particles-nat-gateway": "^0.2.2" | ||
| }, | ||
| "devDependencies": { | ||
| "condensation-particle-tests": "^0.5.2", | ||
| "mocha": "^2.5.3" | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?