Is there a way to load data bags during run time? I am creating some data bag item in a chef run by one recipe and then want to load the same data bag item into an other recipe in the same run. I know there are alternative approaches to send that data via attributes or using node.run_state but still wanted to know if there is any way to make it load lazily when using data_bag_item method.
We use Chef Provisioning to create our resources on AWS and before we create an application stack using recipe2, we need to create the data bags (with server names and config) using recipe1. If the above approach is not a good idea then I will probably need to run the chef client twice with recipe 1 first and then recipe 2. The reason we needed to do both in a single run was because there was a wrapper recipe that calls these recipes one after other periodically to process the submitted stack creation jobs (that creates applications stacks based on requested configuration.