Ask Your Question

Nested stacks and parameter names and defaults

asked 2016-10-11 15:14:25 -0500

woodside gravatar image

updated 2016-11-15 09:13:39 -0500

zaneb gravatar image


I have declared similar 2 nested resources in one single stack as given below:

    type: OS::Nova::MyServer

    type: OS::Nova::MyServer

I have also declared a default parameter in a .env file, which is used while creating the above heat stack:

  stack_name: stack1

which is used internally within MyServer, which is a nested resource, many levels deep. Now, I want to be able to pass a different stack_name for each of obj1 and obj2, which would get passed to the very last level, without changing all the resource levels to include "stack_name" as a parameter input. So, in short, I want it to be a default parameter, but defined in the top level heat yaml file, not in the env file, so that I can give a different name to each object, and not pass it at every level - is there a way to do that?

Another related question: when I use OS::stack_name, internally within the nested stacks, but it changes the stack_name which was given in heat stack-create to the name+random_string -- is there a way to retain the original heat stack name in the internal nested templates?


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-11-15 09:23:13 -0500

zaneb gravatar image

All stacks in a tree of nested stacks get the same environment, so there's no way to specify different parameter defaults for each of them.

OS::stack_name in a nested stack will give the name of the nested stack, not the name of the root stack. Nested stacks can't have the same name as the root stack because stack names must be unique.

edit flag offensive delete link more


Just found

Seems that there is a difference between parameters: section and parameters_defaults: section. And then there is the merge_strategies ...

frippe75 gravatar imagefrippe75 ( 2016-12-29 16:53:58 -0500 )edit

Realizes after reading the env html a few times that my question is not really related to the orginal. But defining my key_name under parameter_defaults made it available in nested yaml files as well. So for parameters: you really need to keep passing then explicitly.

frippe75 gravatar imagefrippe75 ( 2016-12-29 17:02:48 -0500 )edit

answered 2016-12-29 15:57:48 -0500

frippe75 gravatar image

Not sure If I'm out of my depths here. But was that the answer to the question? I'm facing a problem where I think I have the same issue as the original question.

I pass a env file to "openstack stack create ...." The env contains among other parameters the parameter key_name=mykey2.

So my first level yaml file look like:

    type: string

    type: single_server.yaml
      # key_name: {get_param: key_name}   ## Not passing the key_name here

I.e key_name gets passed down to to single_server.yaml

    type: string
    default: mykey

type: OS::Nova::Server

      key_name: {get_param: key_name}

Error is that mykey is missing. Using a different openstack setup where mykey is not uploaded. I was under the impression parameters had to be passed explicitly down the tree. If this is the case my templates tends to get quite repetetive. Would be nice to have an option to pass all env down with an option.

May a different question all together?

edit flag offensive delete link more


parameter_defaults does what you want here - passes the same default values to all nested templates. The question was about passing different values to different nested templates.

zaneb gravatar imagezaneb ( 2017-01-02 08:25:07 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2016-10-11 15:14:25 -0500

Seen: 706 times

Last updated: Dec 29 '16