# Terrafrom and idempotency in azure (increasing node count)?

**URL:** <https://discuss.hashicorp.com/t/terrafrom-and-idempotency-in-azure-increasing-node-count/15053>\
**Category:** Terraform\
**Created:** [October 3, 2020, 9:10am UTC](https://discuss.hashicorp.com/t/terrafrom-and-idempotency-in-azure-increasing-node-count/15053 "2020-10-03T09:10:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev-samples](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/dev-samples/32/12375_2.png) [@dev-samples](https://discuss.hashicorp.com/u/dev-samples)\
**Post date:** [October 3, 2020, 9:10am UTC](https://discuss.hashicorp.com/t/terrafrom-and-idempotency-in-azure-increasing-node-count/15053/1 "2020-10-03T09:10:03Z")

</div>

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?](https://stackoverflow.com/questions/58840666/terraform-apply-how-to-increment-count-and-add-kubernetes-worker-nodes-to-the-e)

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:

> **[Change Infrastructure | Terraform - HashiCorp Learn](https://learn.hashicorp.com/tutorials/terraform/aws-change)**
>
> Modify EC2-instance configuration to use a different Ubuntu version. Plan and apply the changes to re-provision a new instance that reflects the new configuration. Learn how Terraform handles infrastructure change management.

> **[Change Infrastructure | Terraform - HashiCorp Learn](https://learn.hashicorp.com/tutorials/terraform/aws-change?in=terraform%2Faws-get-started)**
>
> Modify EC2-instance configuration to use a different Ubuntu version. Plan and apply the changes to re-provision a new instance that reflects the new configuration. Learn how Terraform handles infrastructure change management.

so it seems that it can handle some operations on existing infrastructure - though I am missing the specific examples (also applying for azure).
