Skip to content

Instantly share code, notes, and snippets.

@badri
Created February 25, 2023 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badri/a3e057bee9bfc10ce4fc56a05c71d9fc to your computer and use it in GitHub Desktop.
Save badri/a3e057bee9bfc10ce4fc56a05c71d9fc to your computer and use it in GitHub Desktop.
Terraform count based resource management
$ terraform apply
random_id.cluster_name[0]: Refreshing state... [id=26Ak6SRX]
azurerm_resource_group.rg[0]: Refreshing state... [id=/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/K8sRG1]
data.azurerm_kubernetes_service_versions.current[0]: Reading...
data.azurerm_kubernetes_service_versions.current[0]: Read complete after 1s [id=/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/providers/Microsoft.ContainerService/locations/southindia]
azurerm_kubernetes_cluster.aks[0]: Refreshing state... [id=/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/K8sRG1/providers/Microsoft.ContainerService/managedClusters/k8s-dba024e92457]
azurerm_public_ip.public_ip[0]: Refreshing state... [id=/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/MC_K8sRG1_k8s-dba024e92457_southindia/providers/Microsoft.Network/publicIPAddresses/k8s-public-ip-dba024e92457]
local_file.kubeconfigaks[0]: Refreshing state... [id=6d63d7a3898cbab172185eb9d0d1d56b753f4d3b]
azurerm_kubernetes_cluster_node_pool.aks_node_pool[0]: Refreshing state... [id=/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/K8sRG1/providers/Microsoft.ContainerService/managedClusters/k8s-dba024e92457/agentPools/nodepool1]
azurerm_kubernetes_cluster_node_pool.aks_node_pool[1]: Refreshing state... [id=/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/K8sRG1/providers/Microsoft.ContainerService/managedClusters/k8s-dba024e92457/agentPools/nodepool2]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
- destroy
-/+ destroy and then create replacement
Terraform will perform the following actions:
# azurerm_kubernetes_cluster_node_pool.aks_node_pool[0] must be replaced
-/+ resource "azurerm_kubernetes_cluster_node_pool" "aks_node_pool" {
- custom_ca_trust_enabled = false -> null
- enable_auto_scaling = false -> null
- enable_host_encryption = false -> null
- enable_node_public_ip = false -> null
- fips_enabled = false -> null
~ id = "/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/K8sRG1/providers/Microsoft.ContainerService/managedClusters/k8s-dba024e92457/agentPools/nodepool1" -> (known after apply)
~ kubelet_disk_type = "OS" -> (known after apply)
- max_count = 0 -> null
~ max_pods = 110 -> (known after apply)
- min_count = 0 -> null
~ name = "nodepool1" -> "nodepool2" # forces replacement
~ node_count = 1 -> 2
~ node_labels = {} -> (known after apply)
- node_taints = [] -> null
~ orchestrator_version = "1.26.0" -> (known after apply)
~ os_disk_size_gb = 128 -> (known after apply)
~ os_sku = "Ubuntu" -> (known after apply)
tags = {
"foo" = "bar"
"key" = "val"
}
- zones = [] -> null
# (9 unchanged attributes hidden)
}
# azurerm_kubernetes_cluster_node_pool.aks_node_pool[1] will be destroyed
# (because index [1] is out of range for count)
- resource "azurerm_kubernetes_cluster_node_pool" "aks_node_pool" {
- custom_ca_trust_enabled = false -> null
- enable_auto_scaling = false -> null
- enable_host_encryption = false -> null
- enable_node_public_ip = false -> null
- fips_enabled = false -> null
- id = "/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/K8sRG1/providers/Microsoft.ContainerService/managedClusters/k8s-dba024e92457/agentPools/nodepool2" -> null
- kubelet_disk_type = "OS" -> null
- kubernetes_cluster_id = "/subscriptions/104e4289-6059-4afb-885a-982ba31991ee/resourceGroups/K8sRG1/providers/Microsoft.ContainerService/managedClusters/k8s-dba024e92457" -> null
- max_count = 0 -> null
- max_pods = 110 -> null
- min_count = 0 -> null
- mode = "User" -> null
- name = "nodepool2" -> null
- node_count = 2 -> null
- node_labels = {} -> null
- node_taints = [] -> null
- orchestrator_version = "1.26.0" -> null
- os_disk_size_gb = 128 -> null
- os_disk_type = "Managed" -> null
- os_sku = "Ubuntu" -> null
- os_type = "Linux" -> null
- priority = "Regular" -> null
- scale_down_mode = "Delete" -> null
- spot_max_price = -1 -> null
- tags = {
- "foo" = "bar"
- "key" = "val"
} -> null
- ultra_ssd_enabled = false -> null
- vm_size = "Standard_D2_v2" -> null
- zones = [] -> null
}
Plan: 1 to add, 0 to change, 2 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: no
Apply cancelled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment