get_attr to retrieve IP address allocated to an instance
I have been trying to deploy an application in 2 different subnets using heat template. I successfully deployed web server instance and database server instance. In the heat template I use the following function to get the IP address of the database server instance - to configure the DB server in web server instance.
userdata:
str_replace:
template: |
...
...
params:
db_ipaddr: {get_attr: [database_server, networks, private, 0]}
depends_on: database_server
The IP address of the database server is not set in the web server's configuration file. It is empty.
How do I solve this issue?