Debugging OpenStack Heat Template with OS:Heat:CloudConfig resources in OS::Heat::MultipartMime where only the last config was executed. This was pretty frustrating to figure out what was happening. If I rearranged the order, only the last config would execute. It was clear that expected behavior was a trap. Using an example from OpenStack Heat Templates to illustrate proper usage I can illustrate what was happening and what to fix.
I have seen other folks use OS::Heat::SoftwareConfig and then echo their settings to a file to avoid this programming pitfall. The result is less readable, messy code. I knew I was missing something and after a lot of reading and studying templates I found the solution.
Using an example from OpenStack Heat Templates to illustrate proper usage I can illustrate what was happening and what to fix.
The key is the “merge_how” setting in OS::Heat::CloudConfig that makes this work, otherwise the new “- config” would replace the previous OS::Heat::CloudConfig resource. By adding the “merge_how” setting we can override this behavior and append the setting. For each of the configs in the OS::Heat::MultipartMime I had to make sure “merge_how” was added. You can read more about merge_how in the cloud_init docs