runway.cfngin.actions.diff module

CFNgin diff action.

class runway.cfngin.actions.diff.DictValue[source]

Bases: Generic[runway.cfngin.actions.diff._OV, runway.cfngin.actions.diff._NV]

Used to create a diff of two dictionaries.

__init__(key: str, old_value: runway.cfngin.actions.diff._OV, new_value: runway.cfngin.actions.diff._NV) None[source]

Instantiate class.

__eq__(other: object) bool[source]

Compare if self is equal to another object.

changes() List[str][source]

Return changes to represent the diff between old and new value.


Representation of the change (if any) between old and new value.

status() str[source]

Status of changes between the old value and new value.

runway.cfngin.actions.diff.diff_dictionaries(old_dict: Dict[str, runway.cfngin.actions.diff._OV], new_dict: Dict[str, runway.cfngin.actions.diff._NV]) Tuple[int, List[runway.cfngin.actions.diff.DictValue[runway.cfngin.actions.diff._OV, runway.cfngin.actions.diff._NV]]][source]

Calculate the diff two single dimension dictionaries.

  • old_dict – Old dictionary.

  • new_dict – New dictionary.


Number of changed records and the DictValue object containing the changes.

runway.cfngin.actions.diff.format_params_diff(parameter_diff: List[runway.cfngin.actions.diff.DictValue[Any, Any]]) str[source]

Handle the formatting of differences in parameters.


parameter_diff – A list of DictValue detailing the differences between two dicts returned by diff_dictionaries().


A formatted string that represents a parameter diff

runway.cfngin.actions.diff.diff_parameters(old_params: Dict[str, runway.cfngin.actions.diff._OV], new_params: Dict[str, runway.cfngin.actions.diff._NV]) List[runway.cfngin.actions.diff.DictValue[runway.cfngin.actions.diff._OV, runway.cfngin.actions.diff._NV]][source]

Compare the old vs. new parameters and returns a “diff”.

If there are no changes, we return an empty list.

  • old_params – old parameters

  • new_params – new parameters


A list of differences.

class runway.cfngin.actions.diff.Action[source]

Bases: runway.cfngin.actions.deploy.Action

Responsible for diffing CloudFormation stacks in AWS and locally.

Generates the deploy plan based on stack dependencies (these dependencies are determined automatically based on references to output values from other stacks).

The plan is then used to create a changeset for a stack using a generated template based on the current config.

run(*, concurrency: int = 0, dump: Union[bool, str] = False, force: bool = False, outline: bool = False, tail: bool = False, upload_disabled: bool = False, **_kwargs: Any) None[source]

Kicks off the diffing of the stacks in the stack_definitions.

pre_run(*, dump: Union[bool, str] = False, outline: bool = False, **_Action__kwargs: Any) None[source]

Any steps that need to be taken prior to running the action.

Handle CFNgin bucket access denied & not existing.

post_run(*, dump: Union[bool, str] = False, outline: bool = False, **_Action__kwargs: Any) None[source]

Do nothing.

__init__(context: CfnginContext, provider_builder: Optional[ProviderBuilder] = None, cancel: Optional[threading.Event] = None)

Instantiate class.

  • context – The context for the current run.

  • provider_builder – An object that will build a provider that will be interacted with in order to perform the necessary actions.

  • cancel – Cancel handler.

static build_parameters(stack: Stack, provider_stack: Optional[StackTypeDef] = None) List[ParameterTypeDef][source]

Build the CloudFormation Parameters for our stack.

  • stack – A CFNgin stack.

  • provider_stack – An optional CFNgin provider object.


The parameters for the given stack

build_provider() Provider

Build a CFNgin provider.

ensure_cfn_bucket() None

CloudFormation bucket where templates will be stored.

execute(**kwargs: Any) None

Run the action with pre and post steps.

property provider: Provider

Return a generic provider using the default region.

Used for running things like hooks.

s3_stack_push(blueprint: Blueprint, force: bool = False) str

Push the rendered blueprint’s template to S3.

Verifies that the template doesn’t already exist in S3 before pushing.


URL to the template in S3.

stack_template_url(blueprint: Blueprint) str

S3 URL for CloudFormation template object.

property upload_disabled: bool

Whether the CloudFormation template should be uploaded to S3.