title: Running aws instance with connection using terraform
body: <pre><code>resource &quot;aws_instance&quot; &quot;appserver1&quot; {
    ami             = var.imageid
    instance_type   = var.instancetype
    key_name        = var.key
    security_groups = [aws_security_group.allow_all.name]
  
    connection {
      user        = &quot;ubuntu&quot;
      private_key = file(var.privatekeypath)
    }
  
    provisioner &quot;remote-exec&quot; {
      inline = [
        &quot;sudo apt-get update&quot;,
        &quot;sudo apt-get install tomcat7 -y&quot;
      ]
    }
  }
  </code></pre>
  <p><strong>&quot;terraform validate&quot; gives me the error:</strong></p>
  <p>Error: Missing required argument</p>
  <p>on main.tf line 52, in resource &quot;aws_instance&quot; &quot;appserver1&quot;:
  52:   connection {</p>
  <p>The argument &quot;host&quot; is required, but no definition was found.</p>