# Cloud-init not running on azurerm virtual machine creation

**URL:** <https://discuss.hashicorp.com/t/cloud-init-not-running-on-azurerm-virtual-machine-creation/30583>\
**Category:** Azure\
**Created:** [October 12, 2021, 7:09am UTC](https://discuss.hashicorp.com/t/cloud-init-not-running-on-azurerm-virtual-machine-creation/30583 "2021-10-12T07:09:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinaowolabi](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/sinaowolabi/32/22957_2.png) [@sinaowolabi](https://discuss.hashicorp.com/u/sinaowolabi)\
**Post date:** [October 12, 2021, 7:09am UTC](https://discuss.hashicorp.com/t/cloud-init-not-running-on-azurerm-virtual-machine-creation/30583/1 "2021-10-12T07:09:59Z")

</div>

Hi!

```auto
  template = "${file("${path.module}/cloud-init.yaml")}"
}

data "template_cloudinit_config" "config" {
  gzip = true
  base64_encode = true

  part {
    filename = "init.cfg"
    content_type = "text/cloud-config"
    content = "${data.template_file.cloud_config.rendered}"
  }
}

# Create virtual machine
resource "azurerm_linux_virtual_machine" "test_vm" {
  name = "debian10-0"
  location = var.location
  resource_group_name = var.testResGroup.name
  network_interface_ids = [var.network_interface.id]
  size = "Standard_DS1_v2"
  custom_data = data.template_cloudinit_config.config.rendered

```

Hi all. Been trying to understand why my cloud-init isnt applied. terraform is happy with it, everything validates and runs.  
My cloud-init file is a basic file that install packages (including git), and tries to runcmd a git clone command.

```auto
packages:
  - nginx
  - httpd
  - haproxy
  - git 
package_update: true
runcmd:
  - git clone -b current --single-branch https://github.com/vyos/vyos-build

```

Yet nothing happens when the vm is created.

Please what am I doing wrong?
