Skip to content

Commit

Permalink
Merge branch 'release/0.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcgrath committed Jan 9, 2017
2 parents f4982d9 + 988b86b commit 7942f50
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,11 @@ All notable changes to this project will be documented here in
accordance with [Keep a CHANGELOG][keep-changelog-url].
This project adheres to [Semantic Versioning][semver-url].

## [0.1.9] - 2017-01-09
### Fixed
- Always set PhysicalId if it exists. Fixes issues with updates that
incorrectly change the ID when null is returned

## [0.1.8] - 2016-11-20
### Added
- Accept and pass through options for cfn-responder
Expand Down
10 changes: 9 additions & 1 deletion lib/project/handler.js
Expand Up @@ -6,7 +6,15 @@ var path = require("path");
var util = require("../util");


module.exports = function(event,context) {
/**
* Main entrypoint for a lambda-formation project
* @param {Object} event - The event object
* @param {string} event.ResourceType - The resource to target in the project
* @param {string} event.RequestType - Create|Update|Delete for the resource
* @param {Object} context - Context passed by Lambda
* @returns {undefined}
*/
module.exports = function handler(event,context) {
var ev;

try {
Expand Down
15 changes: 11 additions & 4 deletions lib/resource/handler.js
@@ -1,8 +1,15 @@
var util = require('../util'),
callerId = require('caller-id'),
path = require('path'),
_ = require('lodash');
var _ = require("lodash");
var callerId = require("caller-id");
var path = require("path");
var util = require("../util");

/**
* Entrypoint for a ResourceType
* @param {Object} event - The event object
* @param {string} event.RequestType - Create|Update|Delete for the resource
* @param {Object} context - Context passed by Lambda
* @returns {undefined}
*/
module.exports = function(event, context) {

var ev;
Expand Down
8 changes: 4 additions & 4 deletions lib/resource/index.js
@@ -1,7 +1,7 @@
var create = require('./create'),
destroy = require('./delete'),
handler = require('./handler'),
update = require('./update');
var create = require("./create");
var destroy = require("./delete");
var handler = require("./handler");
var update = require("./update");

module.exports = {
create: create,
Expand Down
9 changes: 9 additions & 0 deletions lib/util/done.js
Expand Up @@ -4,7 +4,16 @@ var response = require("cfn-responder");
module.exports = function(err, event, context, obj, physicalResourceId, options) {
options = options || {};

/*
* Is this request from CloudFormation
*/
if (event && event.StackId) {
/*
* If CloudFormation sent a physicalReourceId and none has been passed here, use what CloudFormation sent.
* this will ensure that updates and deletes will continute to be correlated in CloudFormation
*/
physicalResourceId = physicalResourceId || event.PhysicalResourceId;

var responseStatus = response.SUCCESS;
if (err) {
event.Reason = err;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "lambda-formation",
"version": "0.1.8",
"version": "0.1.9",
"publishConfig": {
"tag": "latest"
},
Expand Down

0 comments on commit 7942f50

Please sign in to comment.