Unable to access attributes of nested resources in heat
I have the following templates (skipping obvious details):
Included template (LIB::Dbport)
resources:
dbport:
type: OS::Neutron::Port
properties:
network: { get_param: my_network }
fixed_ips:
- subnet_id: {get_param: my_subnet}
security_groups:
- { get_resource: security_group }
outputs:
dbportip:
description: The IP addess of db
value: { get_attr: [dbport,fixed_ips,0,ip_address] }
dbport:
description: The network port of db
value: { get_resource: dbport }
If I launch only this as a stack, I get the IP address. Now In include this in a 'main' template and try to create a resource group: Main template which includes the above:
resources:
dbport_cluster:
type: OS::Heat::ResourceGroup
properties:
count: { get_param: cluster_size }
resource_def:
type: LIB::Dbport
properties:
my_network: { get_param: my_network }
outputs:
db_ports:
description: Ports of DB server instances
value: {get_attr: [dbport_cluster,dbport] }
db_ips:
description: IP addreses of DB server instances
value: {get_attr: [dbport_cluster,dbport, fixed_ips,0,ip_address] }
Now when I create the stack with count(cluster_size)=2, I do get two instance of DB ports created, but the output db_ips shows null. I do see valid ports for db_ports and I am able to do "show port" for both of them and I see good IP addresses. My question: Why don't I get valid IP addresses for the output "db_ips"? What can I do to get IP addresses?