kismatic
kismatic copied to clipboard
Add ability to destroy a single node
Currently the provisioner can only mutate to destroy nodes indiscriminately, it would be ideal if the user could specify what nodes they want to destroy during a mutation.
After some extensive testing, this doesn't seem to be possible with current implementations of Terraform. Resources cannot be targeted by their index, matching my observed output with a discussion on the Terraform Gitter. IE a terraform destroy -target=aws_instance.worker.2
does not work, and won't remove worker 2, but a terraform destroy -target=aws_instance.worker
does - though it obviously does not yield the desired behavior. Tagging this as needing an upstream fix for now, and leaving the issue open.
@emmetthitz were there any workarounds or is there just no way to remove a specific resource?
The easiest way would be for the user to set the number of nodes in the plan file from N to N-1 As long as everything is in an ASG (or equivalent) terraform can do the rest.
@swade1987 The motivation here is that a user might want to drain a node, delete it from the cluster and then choose a specific node to delete.
@dkoshkin sure but then you are treating your servers as pets rather than cattle.
@swade1987 in the case where you want to scale down, it would be nice to be able to delete a specific node. I think that's what @dkoshkin meant.
@emmetthitz this isn't how cloud providers work through.
They either scale up or down based on underlying cloud monitoring which usually monitors CPU or RAM usage on nodes and basis decisions off these.