0

When having a multi-instance provisioning that needs to be reduced - can I control which of the existing resource will be killed?

I have a Kafka cluster with variable load, so I would like to provide broker clients a list of currently working brokers, and for that list I'd like to know which one will get discarded if I reduce the terraform count.

mjahr
  • 3
  • 4
  • Duplicate of https://stackoverflow.com/questions/48324723/terraform-how-to-destroy-oldest-instance-when-lowering-aws-instance-count You can control which resource gets destroyed by editing the tfstate. – Henrik Pingel Jul 18 '19 at 16:37

1 Answers1

0

You can't specifically control which instances are discarded, but it's deterministic. If you have a count of 3 and reduce that to 2, the third instance will be the one that is discarded. If you have 10 instances and reduce it to 8, the 9th and 10th instances are discarded, etc.

bodgit
  • 4,751
  • 16
  • 27