runway.cfngin.blueprints.raw module

CFNgin blueprint representing raw template module.

class runway.cfngin.blueprints.raw.RawTemplateBlueprint[source]

Bases: Blueprint

Blueprint class for blueprints auto-generated from raw templates.

context

CFNgin context object.

description

The description of the CloudFormation template that will be generated by this Blueprint.

mappings

CloudFormation Mappings to be added to the template during the rendering process.

name

Name of the Stack that will be created by the Blueprint.

raw_template_path

Path to the raw CloudFormation template file.

Type:

Path

__init__(name: str, context: runway.context.CfnginContext, *, description: str | None = None, mappings: dict[str, Any] | None = None, raw_template_path: Path, **_: Any) None[source]

Instantiate class.

Changed in version 2.0.0: Class only takes 2 positional arguments. The rest are now keyword arguments.

property output_definitions: dict[str, dict[str, Any]]

Get the output definitions.

Added in version 2.0.0.

Returns:

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

property parameter_definitions: dict[str, Any]

Get the parameter definitions to submit to CloudFormation.

Added in version 2.0.0.

Returns:

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

property parameter_values: dict[str, list[Any] | str]

Return a dict of variables with type CFNType.

Added in version 2.0.0.

Returns:

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

render_template() tuple[str, str][source]

Load template and generate its md5 hash.

property rendered: str

Return (generating first if needed) rendered Template.

property requires_change_set: bool

Return True if the underlying template has transforms.

resolve_variables(provided_variables: list[Variable]) None[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 of provided variables.

to_dict() dict[str, Any][source]

Return the template as a python dictionary.

Returns:

the loaded template as a python dictionary

Return type:

dict

to_json(variables: dict[str, Any] | None = None) str[source]

Return the template in JSON.

Parameters:

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

property version: str

Return (generating first if needed) version hash.

runway.cfngin.blueprints.raw.get_template_path(file_path: Path) Path | None[source]

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

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

Parameters:

file_path – Template path.

Returns:

Path to file, or None if no file found

runway.cfngin.blueprints.raw.resolve_variable(provided_variable: Variable | None, blueprint_name: str) Any[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 – The variable value provided to the blueprint.

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

Raises:

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