runway.lookups.handlers.var module¶
Retrieve a variable from the variables file or definition.
If the Lookup is unable to find an defined variable matching the
provided query, the default value is returned or a ValueError
is raised
if a default value was not provided.
Nested values can be used by providing the full path to the value but, it will not select a list element.
The returned value can contain any YAML support data type (dictionaries/mappings/hashes, lists/arrays/sequences, strings, numbers, and booleon).
Arguments
This Lookup supports all Common Lookup Arguments but, the folling have limited or no effect:
region
Example
deployment:
- modules:
- path: sampleapp.cfn
parameters:
ami_id: ${var ami_id.${env AWS_REGION}}
env_vars:
SOME_VARIABLE: ${var some_variable::default=default}
-
class
runway.lookups.handlers.var.
VarLookup
[source]¶ Bases:
runway.lookups.handlers.base.LookupHandler
Variable definition Lookup.
-
classmethod
handle
(value, context, **kwargs)[source]¶ Retrieve a variable from the variable definition.
The value is retrieved from the variables passed to Runway using either a variables file or the
variables
directive of the config file.- Parameters
value – The value passed to the Lookup.
variables – The resolved variables pass to Runway.
- Raises
ValueError – Unable to find a value for the provided query and a default value was not provided.
-
classmethod