HI @Ravikanth_B & @tjyang there has been some progress.
Our solution is based on an APi driven IPAM system. Most IPAMs operate in the same fashion. Our VMProvision_VM statemachine calls the reserve instance (note the on_entry method network_query). Our Retire flow calls the release instace.
Our IPAM networks are tagged and we use these tags in our network_query method to find the necessary ipam network_id, assigned to a state variable (set_state_var). With that the reserve method can make the reserve ip call. The response includes a ipam_id which we assign to an option (set_option). You need to store this ipam_id to make the release call. At PostProvision in VMProvision_VM we assign the ipam_id (get_option) to the provisioned vm as a custom attribute (custom_set_option). When VM is retire we get the custom atttribute to make the release call.
The methods use require ‘rest-client’
Check out Peter’s Mastering CF Automation. Make Objectwalker and reader your best friends and play alot. 


