Query Syntax

<hook.data_key>[::<arg>=<arg-val>, ...]

When using hooks, you can have the hook store results in the CfnginContext.hook_data dictionary on the context by setting data_key in the hook config.

This lookup lets you look up values in that dictionary. A good example of this is when you use the aws_lambda.upload_lambda_functions to upload AWS Lambda code, then need to pass that code object as the Code variable in a Blueprint.

Changed in version 2.0.0: Support for the syntax deprecated in 1.5.0 has been removed.

Changed in version 1.5.0: The <hook_name>::<key> syntax was deprecated with support being added for the key.nested_key syntax for accessing data within a dictionary.


This Lookup supports all Common Lookup Arguments but, the following have limited or no effect:

  • region


# If you set the ``data_key`` config on the aws_lambda hook to be "myfunction"
# and you name the function package "TheCode" you can get the troposphere
# awslambda.Code object with:

Code: ${hook_data myfunction.TheCode}

# If you need to pass the code location as individual strings for use in a
# CloudFormation template instead of a Blueprint, you can do so like this:

Bucket: ${hook_data myfunction.TheCode::load=troposphere, get=S3Bucket}
Key: ${hook_data myfunction.TheCode::load=troposphere, get=S3Key}