[chef] Using data generated in a LWRP


Chronological Thread 
  • From: Nick Peirson < >
  • To:
  • Subject: [chef] Using data generated in a LWRP
  • Date: Mon, 02 Apr 2012 18:21:05 +0100

Hi all,

I've only been using chef for a couple of months, so bear with me if I mangle the terminology :)

I've got a LWRP that's creating an AWS RDS instance. Within the LWRP I wait till the RDS instance becomes available (while loop + sleep) and get it's details, of which I'm particularly interested in the endpoint address. I can log this by doing something along the lines of:
Chef::Log.info("RDS endpoint address is #{rds_instance[:endpoint_address]}")
What I now want to do is subscribe to the resource that's using this provider to create the rds_instance and for the subscribing resource to have the rds_instance object available, particularly the endpoint address. The subscribing resource is then going to connect to the RDS instance create a database, set up some permissions, etc.

Is there a way to pass this information, e.g. something along the lines of making the rds_instance object available? If not, my other thought is to store it on the node or in a data bag, but this seems like a hack to get round a limitation that's only there due to my lack of knowledge.

I'm reasonably new to both chef and ruby, so hopefully the solution is obvious to more experienced chef/ruby devs. Any advice greatly appreciated.

Thanks
Nick





Archive powered by MHonArc 2.6.16.

§