runway.cfngin.lookups.handlers.split module¶
Split lookup.
-
class
runway.cfngin.lookups.handlers.split.
SplitLookup
[source]¶ Bases:
runway.lookups.handlers.base.LookupHandler
Split lookup.
-
classmethod
handle
(value, context=None, provider=None, **kwargs)[source]¶ Split the supplied string on the given delimiter, providing a list.
- Parameters
value (str) – Parameter(s) given to this lookup.
context (
runway.cfngin.context.Context
) – Context instance.provider (
runway.cfngin.providers.base.BaseProvider
) – Provider instance.
- Returns
Looked up value.
- Return type
Format of value:
<delimiter>::<value>
Example
Subnets: ${split ,::subnet-1,subnet-2,subnet-3}
Would result in the variable Subnets getting a list consisting of:
["subnet-1", "subnet-2", "subnet-3"]
This is particularly useful when getting an output from another stack that contains a list. For example, the standard vpc blueprint outputs the list of Subnets it creates as a pair of Outputs (
PublicSubnets
,PrivateSubnets
) that are comma separated, so you could use this in your config:Subnets: ${split ,::${output vpc::PrivateSubnets}}
-
classmethod