Add resource_group index lookup example
This has been a FAQ in #heat recently, so add an example showing how you can do a list/map lookup via %index% by using a nested stack. Change-Id: I0484e0b69baa6cd0b57fe5d12a9ec87c5a56bc6f
This commit is contained in:
parent
e9d9662bb6
commit
c9c5e158c9
17
hot/resource_group/random.yaml
Normal file
17
hot/resource_group/random.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
heat_template_version: 2015-10-15
|
||||
|
||||
parameters:
|
||||
lengths:
|
||||
type: comma_delimited_list
|
||||
index:
|
||||
type: number
|
||||
|
||||
resources:
|
||||
random:
|
||||
type: OS::Heat::RandomString
|
||||
properties:
|
||||
length: {get_param: [lengths, {get_param: index}]}
|
||||
|
||||
outputs:
|
||||
value:
|
||||
value: {get_attr: [random, value]}
|
26
hot/resource_group/resource_group_index_lookup.yaml
Normal file
26
hot/resource_group/resource_group_index_lookup.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
heat_template_version: 2015-04-30
|
||||
|
||||
description: Shows how to look up list/map values by group index
|
||||
|
||||
parameters:
|
||||
random_lengths:
|
||||
type: comma_delimited_list
|
||||
default: [4, 5, 6]
|
||||
|
||||
resources:
|
||||
random_group:
|
||||
type: OS::Heat::ResourceGroup
|
||||
properties:
|
||||
count: 3
|
||||
resource_def:
|
||||
type: random.yaml
|
||||
properties:
|
||||
# Note you have to pass the index and the entire list into the
|
||||
# nested template, resolving via %index% doesn't work directly
|
||||
# in the get_param here
|
||||
index: "%index%"
|
||||
lengths: {get_param: random_lengths}
|
||||
|
||||
outputs:
|
||||
all_values:
|
||||
value: {get_attr: [random_group, value]}
|
Loading…
x
Reference in New Issue
Block a user