runway.module.cdk module

CDK module.

class runway.module.cdk.CloudDevelopmentKit[source]

Bases: RunwayModuleNpm[CloudDevelopmentKitOptions]

CDK Runway Module.

__init__(context: RunwayContext, *, explicitly_enabled: bool | None = False, logger: RunwayLogger = <RunwayLogger runway.module.cdk (WARNING)>, module_root: Path, name: str | None = None, options: dict[str, Any] | ModuleOptions | None = None, parameters: dict[str, Any] | None = None, **_: Any) None[source]

Instantiate class.

Parameters:
  • context – Runway context object for the current session.

  • explicitly_enabled – Whether or not the module is explicitly enabled. This is can be set in the event that the current environment being deployed to matches the defined environments of the module/deployment.

  • logger – Used to write logs.

  • module_root – Root path of the module.

  • name – Name of the module.

  • options – Options passed to the module class from the config as options or module_options if coming from the deployment level.

  • parameters – Values to pass to the underlying infrastructure as code tool that will alter the resulting infrastructure being deployed. Used to templatize IaC.

cdk_bootstrap() None[source]

Execute cdk bootstrap command.

cdk_deploy() None[source]

Execute cdk deploy command.

cdk_destroy() None[source]

Execute cdk destroy command.

cdk_diff(stack_name: str | None = None) None[source]

Execute cdk diff command.

cdk_list() list[str][source]

Execute cdk list command.

property cli_args: list[str]

Generate CLI args from self used in all CDK commands.

property cli_args_context: list[str]

Generate CLI args from self passed to CDK commands as --context.

deploy() None[source]

Run cdk deploy.

destroy() None[source]

Run cdk destroy.

gen_cmd(command: Literal['bootstrap', 'context', 'deploy', 'destroy', 'diff', 'docs', 'doctor', 'init', 'list', 'metadata', 'synthesize'], args_list: list[str] | None = None, *, include_context: bool = False) list[str][source]

Generate and log a CDK command.

This does not execute the command, only prepares it for use.

Parameters:
  • command – The CDK command to be executed.

  • args_list – Additional arguments to include in the generated command.

  • include_context – Optionally, pass context to the CLI. Context is not valid for all commands.

Returns:

The full command to be passed into a subprocess.

init() None[source]

Run cdk bootstrap.

plan() None[source]

Run cdk diff.

run_build_steps() None[source]

Run build steps.

property skip: bool

Determine if the module should be skipped.

class runway.module.cdk.CloudDevelopmentKitOptions[source]

Bases: ModuleOptions

Module options for AWS Cloud Development Kit.

build_steps

A list of commands to be executed before each action (e.g. diff, deploy, destroy).

data

Options parsed into a data model.

skip_npm_ci

Skip running npm ci in the module directory prior to processing the module.

__init__(data: RunwayCdkModuleOptionsDataModel) None[source]

Instantiate class.

Parameters:

data – Options parsed into a data model.

classmethod parse_obj(obj: object) CloudDevelopmentKitOptions[source]

Parse options definition and return an options object.

Parameters:

obj – Object to parse.