Hi,
When creating an AKS cluster using the azurerm_kubernetes_cluster
resource, a separate Infrastructure resource group is created automatically by Azure. But TF only provided a .node_resource_group
property to access its name.
I tried to import the resource using the azurerm_resources
data resource, but it often failed to import the state.
How should I manage the AKS node resource?
Thanks
Not really a terraform question but rather Azure-specific one, but anyway…
You are not supposed to touch the node resource group at all.
Also there is no need to import it into terraform because it’s not managed by you, it’s a child resource group of your AKS cluster and its lifecycle is tied to the lifecycle of the cluster: you delete the cluster, the whole group is gone.
If you want to create any of your own resources in that rg, just reference its name. Of course its available only after the AKS cluster is created.
I personally prefer and try to use separate groups for the extra resources and not touch that node rg at all.
FAQ which might be helpful: Frequently asked questions for Azure Kubernetes Service (AKS) - Azure Kubernetes Service | Microsoft Docs
Agree, I should have created my own RG to manage the Vnet.