[openstack-dev] [Heat] Re-evaluate conditions specification

Thomas Herve therve at redhat.com
Thu Mar 31 11:54:56 UTC 2016


On Thu, Mar 31, 2016 at 10:40 AM, Thomas Herve <therve at redhat.com> wrote:
> Hi all,
>
> As the patches for conditions support are incoming, I've found
> something in the code (and the spec) I'm not really happy with. We're
> creating a new top-level section in the template called "conditions"
> which holds names that can be reused for conditionally creating
> resource.
>
> While it's fine and maps to what AWS does, I think it's a bit
> short-sighted and limited. What I have suggested in the past is to
> have a "variables" (or whatever you want to call it) section, where
> one can declare names and values. Then we can add an intrinsic
> function to retrieve data from there, and use that for examples for
> conditions.

I was asked to give examples, here's at least one that can illustrate
what I meant:

parameters:
   host:
      type: string
   port:
      type: string

variables:
   endpoint:
      str_replace:
        template:
           http://HOST:PORT/
        params:
           HOST: {get_param: host}
           PORT: {get_param: port}

resources:
   config1:
      type: OS::Heat::StructuredConfig
      properties:
        config:
           hosts: [{get_variable: endpoint}]

-- 
Thomas



More information about the OpenStack-dev mailing list