Heat Orchestration Template (HOT) conditional resource creation

asked 2015-08-31 03:21:01 -0500

Vanja gravatar image

updated 2015-09-01 03:52:47 -0500

I am trying to create a HOT file that would support conditional creation of two different types of provider networks. In one case network should be VLAN tagged and in the other case it should be flat. What I did so far looks like: ..........................................

###Creating networks###
  nw_om_sc_fee:
    properties:
      name: { list_join: ['_', [{get_param: tenant}, {get_param: om_sc_fee_nw_name}]]}
      network_type: { "Fn::Select" : [ { get_param: soft_router }, {"false": "vlan", "true": "flat"} ] }
      physical_network: { get_param: om_sc_fee_nw_physnet }
      segmentation_id: { "Fn::Select" : [ { get_param: soft_router }, {"false": { get_param: om_sc_fee_nw_vlan }, "true": "0"} ] }
      shared: false
    type: OS::Neutron::ProviderNet

...........................................

Two different configurations are based on "soft_router" parameter with values "true" and "false". It affects "network_type" and "segmentation_id" parameters. For "network_type" everything works fine since both values "vlan" and "flat" are regular. However, as soon as I have "flat" network_type, "segmentation_id" parameter does not have any meaning and I get error for just having parameter present. Also setting it to empty string as shown above is not possible since it is not valid value.

Is there any way to solve this issue, e.g. is it possible to have conditional parameter or conditional resource creation?

edit retag flag offensive close merge delete