runway.lookups.handlers.cfn module

Retrieve a value from CloudFormation Stack Outputs.

The query syntax for this lookup is <stack-name>.<output-name>. When specifying the output name, be sure to use the Logical ID of the output; not the Export.Name.

If the Lookup is unable to find a CloudFormation Stack Output matching the provided query, the default value is returned or an exception is raised to show why the value could be be resolved (e.g. Stack does not exist or output does not exist on the Stack).

Arguments

This Lookup supports all Common Lookup Arguments.

Example

Runway config
deployments:
  - modules:
      path: sampleapp.tf
      options:
        terraform_backend_config:
          bucket: ${cfn common-tf-state.TerraformStateBucketName::region=us-east-1}
          dynamodb_table: ${cfn common-tf-state.TerraformStateTableName::region=us-east-1}
          region: us-east-1
CFNgin config
stacks:
  my-stack:
    variables:
      SomeParameter: ${cfn AnotherStack.OutputName}
class runway.lookups.handlers.cfn.OutputQuery(stack_name, output_name)

Bases: tuple

Create new instance of OutputQuery(stack_name, output_name)

property output_name

Alias for field number 1

property stack_name

Alias for field number 0

class runway.lookups.handlers.cfn.CfnLookup[source]

Bases: runway.lookups.handlers.base.LookupHandler

CloudFormation Stack Output lookup.

static should_use_provider(args, provider)[source]

Determine if the provider should be used for the lookup.

This will open happen when the lookup is used with CFNgin.

Parameters
  • args – Parsed arguments provided to the lookup.

  • provider – CFNgin provider.

static get_stack_output(client, query)[source]

Get CloudFormation Stack output.

Parameters
  • client – Boto3 CloudFormation client.

  • query (OutputQuery) – What to get.

Returns

Value of the requested output.

Return type

str

classmethod handle(value, context, provider=None, **_)[source]

Retrieve a value from CloudFormation Stack outputs.

Parameters
  • value – The value passed to the Lookup.

  • context – The current context object.

  • provider – AWS provider.

Returns

Result of the query.

Raises

OutputDoesNotExist – Output does not exist on the Stack provided and default was not provided.