title: Terraform `local-exec` to set a local alias
body: <p>I'm trying to set up an alias to quickly ssh into the newly created host when I create an AWS instance in <a href="/questions/tagged/terraform" class="post-tag" title="show questions tagged &#39;terraform&#39;" rel="tag">terraform</a>. I do this by running</p>
  
  <pre><code># Handy alias to quickly ssh into newly created host
  provisioner "local-exec" {
      command = "alias sshopenldap='ssh -i ${var.key_path} ubuntu@${aws_instance.ldap_instance.public_dns}'"
  }
  </code></pre>
  
  <p>When I see the output of this execution:</p>
  
  <pre><code>aws_instance.ldap_instance (local-exec): Executing: /bin/sh -c "alias sshopenldap='ssh -i ~/.ssh/mykey.pem ubuntu@ec2-IP.compute-1.amazonaws.com'"
  </code></pre>
  
  <p>It seems to be ok, but the alias is not set. Could this be that the way the command is being run it wraps it in a new scope and not the one of the current shell? If I copy paste the command as is to the console the alias is set fine.</p>
  
  <p>Is there a workaround for this?</p>
  
  <p><em>I'm running terraform a MacOS X Mountain Lion's terminal.</em></p>