I need instance group manager created multiple instances and then let each instance run a start-up script. But I hope this instance creation has some order or intervals. Cause if multiple nodes run same start up script at same time. This will made some conflict results. And only one node can join to my distributed cluster. I thought add some random sleep into my start up script to let different instance can trigger start up script at different timestamp. But this is too hacky and unpredictable for our infra.
I also tried to change instance_group_manager target size in my local start up script like set that target_size from 1 to n. But this will take too long time to destroy and create one instance and each time it will refresh a new ip for each instance. This will let my master node really confuse about data nodes IP.
So does any one know how to set up dependency in instance_group_manager to create multiple instances especially by using terraform?