runway.cfngin.blueprints.raw module

CFNgin blueprint representing raw template module.

runway.cfngin.blueprints.raw.get_template_path(filename)[source]

Find raw template in working directory or in sys.path.

template_path from config may refer to templates colocated with the Stacker config, or files in remote package_sources. Here, we emulate python module loading to find the path to the template.

Parameters

filename (str) – Template filename.

Returns

Path to file, or None if no file found

Return type

Optional[str]

runway.cfngin.blueprints.raw.get_template_params(template)[source]

Parse a CFN template for defined parameters.

Parameters

template (dict) – Parsed CFN template.

Returns

Template parameters.

Return type

dict

runway.cfngin.blueprints.raw.resolve_variable(provided_variable, blueprint_name)[source]

Resolve a provided variable value against the variable definition.

This acts as a subset of resolve_variable logic in the base module, leaving out everything that doesn’t apply to CFN parameters.

Parameters
  • provided_variable (runway.cfngin.variables.Variable) – The variable value provided to the blueprint.

  • blueprint_name (str) – The name of the blueprint that the variable is being applied to.

Returns

The resolved variable string value.

Return type

object

Raises

UnresolvedVariable – Raised when the provided variable is not already resolved.

class runway.cfngin.blueprints.raw.RawTemplateBlueprint(name, context, raw_template_path, mappings=None, description=None)[source]

Bases: runway.cfngin.blueprints.base.Blueprint

Blueprint class for blueprints auto-generated from raw templates.

Instantiate class.

to_json(variables=None)[source]

Return the template in JSON.

Parameters

variables (dict) – Unused in this subclass (variables won’t affect the template).

Returns

the rendered CFN JSON template

Return type

str

to_dict()[source]

Return the template as a python dictionary.

Returns

the loaded template as a python dictionary

Return type

dict

render_template()[source]

Load template and generate its md5 hash.

get_parameter_definitions()[source]

Get the parameter definitions to submit to CloudFormation.

Returns

parameter definitions. Keys are parameter names, the values are dicts containing key/values for various parameter properties.

Return type

Dict[str, Any]

get_output_definitions()[source]

Get the output definitions.

Returns

output definitions. Keys are output names, the values are dicts containing key/values for various output properties.

Return type

Dict[str, Any]

resolve_variables(provided_variables)[source]

Resolve the values of the blueprint variables.

This will resolve the values of the template parameters with values from the env file, the config, and any lookups resolved. The resolution is run twice, in case the blueprint is jinja2 templated and requires provided variables to render.

Parameters

provided_variables (List[runway.cfngin.variables.Variable]) – List of provided variables.

get_parameter_values()[source]

Return a dictionary of variables with type CFNType.

Returns

variables that need to be submitted as CloudFormation Parameters. Will be a dictionary of <parameter name>: <parameter value>.

Return type

Dict[str, Any]

property requires_change_set

Return True if the underlying template has transforms.

property rendered

Return (generating first if needed) rendered template.

property version

Return (generating first if needed) version hash.