Ask Your Question

bkannada's profile - activity

2019-02-03 17:44:49 -0500 answered a question openstack heat: Add port to instance based on condition

DId you get any solution ?. Btw for me its cribbing on condition:

2019-02-03 17:44:48 -0500 asked a question Is it possible to have a “condition” inside a port creation?

We create a port which the server is dependent on. A user can give either network_id or both network and fixed_ips. We want to allow both configurations.

Apparently what I see is when I don't give fixed ips and have a condition inside port creation I'm getting an error in get_resource. If I don't give condition creation is successful. Blocked with the same..

conditions:
       ccess_ip_input:
         equals:
         - get_param: ccess_ip
         - yes

resources:   g_server:
    type: OS::Nova::Server
    depends_on:
    - am_port
    - ccess_port
    - ore_port_1
    - ore_port_2
    - dm_port
    properties:
      name:
        str_replace:
          template: $instance_name
          params:
            $instance_name: {get_param: instance_name}
      key_name: {get_param: key_name}
      image: {get_param: image}
      flavor: {get_param: flavor}
      scheduler_hints:
        group: {get_param: ng_cluster}
      networks:
      - port: {get_resource: am_port}
      - port: {get_resource: ccess_port}

  ccess_port:
    type: OS::Neutron::Port
    properties:
      name:
        str_replace:
          template: $instance_name-ccess-port
          params:
            $instance_name: { get_param: instance_name }
      network_id: { get_param: ccess_network_id }
      port_security_enabled: False
    condition: ccess_ip_input
    properties:
      fixed_ips:
      - ip_address: { get_param: ccess_ip }

Getting Below Error: ERROR: InvalidTemplateReference: : resources.hng_1: : The specified reference "ccess_port" (in ng_server.Properties.networks[1].port) is incorrect. Please let me know if this is wrong how can I have fixed_ips selectively included if input given and discard if not given. Btw network id will be always given and hence I want to have port creation. I am using queens