title: terraform Error: host for provisioner cannot be empty azurerm
body: <p>here is my config
  I have to add all the configurations in one file</p>
  <p>I have the part of config not related to the issue and keep the part that most important to understand the issue</p>
  <pre><code>
  provider &quot;azurerm&quot; {
    features {}
  }
  
  
  
  
  # Create public IPs
  resource &quot;azurerm_public_ip&quot; &quot;myterraformpublicip&quot; {
    name                = &quot;myPublicIP&quot;
    location            = &quot;eastus&quot;
    resource_group_name = azurerm_resource_group.myterraformgroup.name
    allocation_method   = &quot;Dynamic&quot;
  
    tags = {
      environment = &quot;Terraform Demo&quot;
    }
  }
  
  #create a data to recicve ip
  data &quot;azurerm_public_ip&quot; &quot;myterraformpublicip&quot; {
    name                = azurerm_public_ip.myterraformpublicip.name
    resource_group_name = azurerm_resource_group.myterraformgroup.name
  
  }
  
  output &quot;vm_ip&quot; {
    value = data.azurerm_public_ip.myterraformpublicip.ip_address
  }
  
  # Create (and display) an SSH key
  resource &quot;tls_private_key&quot; &quot;example_ssh&quot; {
    algorithm = &quot;RSA&quot;
    rsa_bits  = 4096
  }
  output &quot;tls_private_key&quot; {
    value     = tls_private_key.example_ssh.private_key_pem
    sensitive = true
  }
  
  # Create virtual machine
  resource &quot;azurerm_linux_virtual_machine&quot; &quot;myterraformvm&quot; {
    name                  = &quot;myVM&quot;
    location              = &quot;eastus&quot;
    resource_group_name   = azurerm_resource_group.myterraformgroup.name
    network_interface_ids = [azurerm_network_interface.myterraformnic.id]
    size                  = &quot;Standard_DS1_v2&quot;
  
    os_disk {
      name                 = &quot;myOsDisk&quot;
      caching              = &quot;ReadWrite&quot;
      storage_account_type = &quot;Premium_LRS&quot;
    }
  
    source_image_reference {
      publisher = &quot;Canonical&quot;
      offer     = &quot;UbuntuServer&quot;
      sku       = &quot;18.04-LTS&quot;
      version   = &quot;latest&quot;
    }
  
    computer_name                   = &quot;myvm&quot;
    admin_username                  = &quot;azureuser&quot;
    disable_password_authentication = true
  
    admin_ssh_key {
      username   = &quot;azureuser&quot;
      public_key = file(&quot;~/.ssh/id_rsa.pub&quot;)
    }
  
    boot_diagnostics {
      storage_account_uri = azurerm_storage_account.mystorageaccount.primary_blob_endpoint
    }
  
    tags = {
      environment = &quot;Terraform Demo&quot;
    }
  }
  
  resource &quot;null_resource&quot; &quot;nginx&quot; {
    provisioner &quot;remote-exec&quot; {
      inline = [
        &quot;sudo yum install nginx -y&quot;,
        &quot;sudo service nginx start&quot;,
        &quot;sudo rm /usr/share/nginx/html/index.html&quot;,
        &quot;echo '&lt;html&gt;&lt;head&gt;&lt;title&gt;Blue Team Server&lt;/title&gt;&lt;/head&gt;&lt;body style=\&quot;background-color:#1F778D\&quot;&gt;&lt;p style=\&quot;text-align: center;\&quot;&gt;&lt;span style=\&quot;color:#FFFFFF;\&quot;&gt;&lt;span style=\&quot;font-size:28px;\&quot;&gt;Blue Team&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;' | sudo tee /usr/share/nginx/html/index.html&quot;
      ]
  
      connection {
        type        = &quot;ssh&quot;
        host        = data.azurerm_public_ip.myterraformpublicip.ip_address
        user        = &quot;azureuser&quot;
        private_key = tls_private_key.example_ssh.private_key_pem
        timeout     = &quot;1m&quot;
      }
    }
  }
  </code></pre>
  <p>I still get the same error after many trials I am a beginner level with terraform and need help, Note: if I apply again the ssh connection to the previous public IP.</p>