Azurerm automatically creates a poorly named resource group


I created a cluster on Azure and it works well.

Here is the simplified config:

resource "azurerm_kubernetes_cluster" "sf4v2" {
  name                 = "myCluster"
  resource_group_name  = "myRG"

  default_node_pool {
    name                 = "default"
    node_count           = 3
    vm_size              = "Standard_D11_v2"
    availability_zones   = ["1", "2", "3"]
    vnet_subnet_id       =
    max_pods             = 250
    orchestrator_version = "1.22.2"
    os_disk_size_gb      = 30

As you can see, the ‘type’ property of the node pool is not defined and the default value is ‘VirtualMachineScaleSets’.

I think this configuration automatically creates a virtual machine scale set in a new resource group named by concatenating the cluster’s resource group and the cluster’s name.
In this poorly named resource group, Terraform will create 4 resources:

  • Virtual machine scale set
  • Load balancer
  • Network security group
  • Public IP address

How can I make Terraform to create all theses resources on the same resource group, the cluster one (myRG)?