I am starting to learn terraform and have deployed a few k8s clusters on azure.
I have tried to increase my autoscaled cluster from 3-5 nodes to 4-6 nodes on an existing cluster already deployed with terraform.
I just updated those values in my local plan, connected to the remote tfstate and re-ran terraform plan
followed by terraform apply
. But terraform ended up re-installing my whole cluster (wiping all the namespaces I had created) instead of just increasing the node min. count and the max count that I specified in my plan.
What is the correct way to change only the parts in an existing cluster that I have change in my plan ( main.tfs
)?
Also I have found:
Terraform apply, how to increment count and add kubernetes worker nodes to the existing workers?
It seems that terrafrom is not really designed to handle these types of use cases. If terraform is not designed to deal with dynamic features as basic as changing min and max node count I am finding it difficult to see why I should bother using it since I have to change these types of properties regularly on the fly (infrastructure as code goes a bit out the window if you can only deploy the initial configuration…).
I also found:
so it seems that it can handle some operations on existing infrastructure - though I am missing the specific examples (also applying for azure).