S
S
shell_guy2022-03-07 14:34:37
Devops
shell_guy, 2022-03-07 14:34:37

Scaling in terraform. How?

Can you please tell me how to raise new instances of virtual machines over the original ones?
If I write a terraform plan, I see that all instances will be deleted and new ones will be created instead. How to avoid this and create further so that after VM-30 VM-31 is created and so on.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2022-03-07
@yellowmew

the same terraform plan will tell you why it wants to replace instances - what parameters of the common configuration for instances have changed if it is impossible to replace them on the fly
If you change an important element in the configuration that cannot be replaced without recreating the instance, it must be ignored through the lifecycle -> ignore changes
However, this way you can potentially only get an increase in the number of objects.
If you are deploying to AWS, then ASG can help - it does not re-create instances unnecessarily when adding the required number of instances. When scaled down, the base policy for deleting instances is to delete the oldest one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question