providers/aws: if no public IP, use private IP for SSH by default

This commit is contained in:
Mitchell Hashimoto 2015-04-22 12:25:28 +02:00
parent a27890b1a6
commit ec38a65dda
1 changed files with 5 additions and 0 deletions

View File

@ -544,6 +544,11 @@ func resourceAwsInstanceCreate(d *schema.ResourceData, meta interface{}) error {
"type": "ssh", "type": "ssh",
"host": *instance.PublicIPAddress, "host": *instance.PublicIPAddress,
}) })
} else if instance.PrivateIPAddress != nil {
d.SetConnInfo(map[string]string{
"type": "ssh",
"host": *instance.PrivateIPAddress,
})
} }
// Set our attributes // Set our attributes