Hello. I'm using the automation API and a set of d...
# automation-api
l
Hello. I'm using the automation API and a set of dynamic resources to create a virtual machine. The process I am taking is like this: 1. Create the VM resource 2. Create device resources (i.e. a virtual disk or NIC) that are dependent on the VM ID 3. Update the boot order (depends on the device IDs) and power state of the VM I want to combine those steps into a component resource, but the problem I am having is how exactly to update the VM resource after it has been defined in a stack. I have circular dependency problem where the devices depend on the VM ID and the VM boot order depends on the device IDs. I have seen some suggestions that involve defining the VM resource twice, the first time to create the resource and the second one to update it including the boot order and power state. This fails with a "Duplicate resource URN" error. Other suggestions I have seen is to create another resource type that represents the VM configuration. I suppose that could work, but it seems redundant if I'm going to have to implement an update method for the VM resource itself anyway. I've also read through the provider functions page and the resource methods section. Those methods both seem like a way to solve my problem, but I have struggled to find any useful examples of how to implement them. Are there any best practices or recommendations for this kind of problem?