[openstack-dev] [heat] cross-stack references
Zane Bitter
zbitter at redhat.com
Mon Sep 23 15:53:08 UTC 2013
On 18/09/13 19:34, Mike Spreitzer wrote:
> When we get into things like affinity concerns or managing network
> bandwidth, we see the need for cross-stack relationships. You may want
> to place parts of a new stack near parts of an existing one, for
> example. I see that in CFN you can make cross-references between
> different parts of a single stack using the resource names that appear
> in the original template. Is there a way to refer to something that did
> not come from the same original template? If not, won't we need such a
> thing to be introduced? Any thoughts on how that would be done?
Yes, you can do this now. In fact, nothing in a template should be
making cross-references using only the resource name. Instead you should
use {"Ref": "resource_name"}. The value returned by this varies, but in
most cases it is just the UUID of the resource. You can return this
value in an output, and you can use an input of the same form (i.e. a
UUID in most cases) in place of a Ref to a local resource in cases where
you want to refer to an existing resource instead of one managed by the
template. A similar story applied to attributes (which are just strings)
and Fn::GetAtt.
There's no magic in a template, it's just functions that manipulate strings.
cheers,
Zane.
Fine Print:
We violate this rule in a number of places in Heat, mostly where there's
no real underlying OpenStack API for a given resource type so we've had
to implement the resource within Heat. CloudFormation does not make this
mistake, and I hope to clean up as many of these as possible over time.
However, none of these are likely relevant to the use case you have in mind.
More information about the OpenStack-dev
mailing list