mapbox / cloudfriend

Helper functions for assembling CloudFormation templates in JavaScript
ISC License
69 stars 9 forks source link

Dereferencing templates #14

Closed rclark closed 6 years ago

rclark commented 7 years ago

Adds functionality to resolve conditions, intrinsic functions, and pseudo parameters into flat strings.

TODO

@k-mahoney on that 3rd point, what would the ideal API for this be from your perspective? To dereference a template you'll need to provide

Should it be something like

var cf = require('cloudfriend');
var dereferenced = cf.dereference(template, parameters, options);

... or is there some other way to format it that might be more useful for what you need?

Fixes #13

rclark commented 7 years ago

@k-mahoney this is ready for you to take it for a spin! As indicated above,

var cf = require('cloudfriend');
var dereferenced = cf.dereference(template, parameters, options);
k-mahoney commented 7 years ago

Awesome, will get this integrated with our tests this week and give it a try!

zmully commented 7 years ago

@rclark is improved test coverage something you'd still like to see before this can be merged?

k-mahoney commented 7 years ago

As it stands this functionality will only work with IAM ref/att values - but I imagine we can get this expanded in a subsequent PR? Scripting that has been on my backlog for a while.

rclark commented 7 years ago

This is more scope creep than I thought it would be when I first set down this road. Its a huge pain in the ass to write all the information needed dereferencing into the codebase, and in the long run this would be a maintenance nightmare -- it needs to stay in sync with CloudFormation. There are also a bunch of unsolvable edge cases.

Can we circle back and huddle on your use-case to see if we can come up with a better solution?

k-mahoney commented 7 years ago

It might make sense, given that we're only using it for tests at this juncture, to retain the parse/dereference logic and provide a template of the desired ref/att values - rather than maintaining the monolith of all possible values.

rclark commented 6 years ago

Closing. This experiment didn't end up being as effective as we'd hoped.