lib/terraform/index.js
function(options, cb) {
        let template, render;
        if(!options.params || !options.params.template || !options.params.template.content) {
            return utils.checkError('Missing template content', 727, cb);
        }

        try {
            template = handlebars.compile(options.params.template.content);
            if(options.params.template._id){
                if(!options.params.input.tags){
                    options.params.input.tags = {};
                }
                options.params.input.tags['soajs.template.id'] = options.params.template._id.toString();
            }
            render = template(options.params.input);
        }
        catch(e) {
            return utils.checkError(e, 727, cb);
        }

        return cb(null, { render });
    }
function(options, cb) {
        let template, render;
        if(!options.params || !options.params.template || !options.params.template.content) {
            return utils.checkError('Missing template content', 727, cb);
        }

        try {
            template = handlebars.compile(options.params.template.content);
            if(options.params.template._id){
                if(!options.params.input.tags){
                    options.params.input.tags = {};
                }
                options.params.input.tags['soajs.template.id'] = options.params.template._id.toString();
            }
            render = template(options.params.input);
        }
        catch(e) {
            return utils.checkError(e, 727, cb);
        }

        return cb(null, { render });
    }
function ( options , cb ) { let template , render ; if ( ! options . params || ! options . params . template || ! options . params . template . content ) { return utils . checkError ( 'Missing template content' , 727 , cb ) ; } try { template = handlebars . compile ( options . params . template . content ) ; if ( options . params . template . _id ) { if ( ! options . params . input . tags ) { options . params . input . tags = { } ; } options . params . input . tags [ 'soajs.template.id' ] = options . params . template . _id . toString ( ) ; } render = template ( options . params . input ) ; } catch ( e ) { return utils . checkError ( e , 727 , cb ) ; } return cb ( null , { render } ) ; }
Render a terraform dynamic template and return output
@param  {Object}   options  Data passed to function as params
@param  {Function} cb    Callback function
@return {void}
Render a terraform dynamic template and return output