[Openstack] Heat template - get port ID of 'external' instance
Zane Bitter
zbitter at redhat.com
Mon Aug 1 14:53:08 UTC 2016
On 31/07/16 10:39, Turbo Fredriksson wrote:
> I've created a environment file:
>
> resource_registry:
> "OS::Nova::Server::Instance": "https://raw.githubusercontent.com/FransUrbo/Openstack-Bayour.COM/master/instance.yaml"
BTW I really wouldn't recommend using the OS:: namespace for your own
custom types.
> I then create an instance from the template:
>
> admin_floating:
> type: OS::Neutron::FloatingIP
> description: LDAP/KRB5 Admin Floating IP
> properties:
> floating_network_id: physical
> # port_id: { get_attr: [admin, networks, { get_param: network }, 0, port]}
> # port_id: { get_attr: [admin, networks, 0, port]}
You want the second one.
> admin:
> type: OS::Nova::Server::Instance
> properties:
> name: instance
> image: { get_param: image }
> size: 5
> flavor: m1.2tiny
> network: { get_param: network }
You're assuming here that doing get_attr on your provider resource will
automatically reach into the nested stack and pull out the attributes of
the resource you're thinking of - which of course would require Heat to
be clairvoyant ;)
You actually need to explicitly export the attributes you want as
outputs from the instance.yaml template, just as you defined parameters
to accept the property values. To make this a bit easier, you can get
the API to generate a template that you can modify with the command:
heat resource-type-template -t hot -F yaml OS::Nova::Server
cheers,
Zane.
More information about the Openstack
mailing list