How to provision file to azure vm scale set

Hi there :slight_smile:
I’m trying to provision a file to all instances of my VM Scaleset. This is my config

## VM Scaleset
resource "azurerm_linux_virtual_machine_scale_set" "data" {
  name                            = "cluster-data-vmss"
  resource_group_name             = var.resource_group.name
  location                        = var.resource_group.location
  sku                             = var.vm_size
  instances                       = var.nodes
  admin_username                  = "adminuser"
  admin_password                  = "myPw1234!"
  computer_name_prefix            = var.prefix
  disable_password_authentication = false

  source_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "18.04-LTS"
    version   = "latest"
  }

  os_disk {
    storage_account_type = "StandardSSD_LRS"
    caching              = "ReadWrite"
  }

  data_disk {
    create_option         = "Empty"
    disk_size_gb          = var.disk_size
    lun                   = "10"
    caching               = "ReadWrite"
    storage_account_type  = "StandardSSD_LRS"
  }

  custom_data = data.template_cloudinit_config.config.rendered
  depends_on = [var.loadbalancer_rules]

  network_interface {
    name    = "nic"
    primary = true

    ip_configuration {
      name      = "internal"
      primary   = true
      subnet_id = var.subnet.id
      load_balancer_backend_address_pool_ids = [var.backend_address_pool.id]
    }
  }

  provisioner "file" {
    source = "${path.module}/config/myconfig.yml"
    destination = "/usr/share/cluster-config"

    connection {
      type     = "ssh"
      user     = self.admin_username
      password = self.admin_password
      host     = self.network_interface[*].private_ip_address
    }
  }
}

It fails always with This object does not have an attribute named "private_ip_address".

Any ideas?

I couldn’t find this attribute within the docs.
Is there any reason not using custom_data for the yml file ?