From 94bf981d3bd0902ed5b3b06b2fbcc484bd90ca74 Mon Sep 17 00:00:00 2001 From: Robert Tarrall Date: Tue, 26 Jul 2016 08:15:44 -0600 Subject: [PATCH] Honor ssh_private_ip flag in EC2-Classic, not just VPC VpcId will be nil in Classic, but we may still wish to ssh to the instance's private IP address -- if for example we are using security groups to block SSH access via the public IP. --- builder/amazon/common/ssh.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go index d689d5990..fdf983368 100644 --- a/builder/amazon/common/ssh.go +++ b/builder/amazon/common/ssh.go @@ -23,6 +23,8 @@ func SSHHost(e *ec2.EC2, private bool) func(multistep.StateBag) (string, error) } else { host = *i.PrivateIpAddress } + } else if private { + host = *i.PrivateIpAddress } else if i.PublicDnsName != nil && *i.PublicDnsName != "" { host = *i.PublicDnsName }