Ask Your Question

Conditional values in Heat Template

asked 2015-01-20 09:41:00 -0500

Suppose In my heat template I have a resource like

    type: OS::Heat::AutoScalingGroup
      min_size: 0
      max_size: 1
          type: OS::Nova::Server
            name: Scaled_Blade
            image: { get_param: image }
            flavor: { get_param: flavor }
            key_name: {get_param: key_pair}
            networks: [{network: {get_param: internal_net} }]

I want to have variable value for max_size property, for example If user has select image : X then max_size : 1 and if user has selected image: y than max_size=4 How can I achieve this ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-01-21 02:28:32 -0500

unmesh-gurjar gravatar image

updated 2015-01-21 02:28:58 -0500

This can be achieved with the help of Mappings and Fn::FindInMap method. You need to define the mapping and use the FindInMap method to retrieve the appropriate value from it.

Refer sample template where for eg on line 100, ImageID is determined based on the value of input parameters 'LinuxDistribution' and 'InstanceType'.

edit flag offensive delete link more


You are right about Fn::FindInMap. But when I used it in my HOT Template, I got following error. ERROR: Invalid key 'mirror_map' for parameter (Mappings)

      fm00: 0
      port1: 1

P.S: I am creating a HOT Template NOT a cfn template

Khayam gravatar imageKhayam ( 2015-01-30 06:35:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2015-01-20 09:41:00 -0500

Seen: 2,157 times

Last updated: Jan 21 '15