diff --git a/CHANGELOG.md b/CHANGELOG.md index 59413ef51..7c064189a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ IMPROVEMENTS: * builder/amazon: In `-debug` mode, the keypair used will be saved to the current directory so you can access the machine. [GH-373] +* builder/amazon: In `-debug` mode, the DNS is outputted. BUG FIXES: diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index 2fd14c98f..fc81b2002 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -10,6 +10,7 @@ import ( ) type StepRunSourceInstance struct { + Debug bool ExpectedRootDevice string InstanceType string UserData string @@ -100,6 +101,17 @@ func (s *StepRunSourceInstance) Run(state map[string]interface{}) multistep.Step } s.instance = latestInstance.(*ec2.Instance) + + if s.Debug { + if s.instance.DNSName != "" { + ui.Message(fmt.Sprintf("Public DNS: %s", s.instance.DNSName)) + } + + if s.instance.PrivateIpAddress != "" { + ui.Message(fmt.Sprintf("Private IP: %s", s.instance.PrivateIpAddress)) + } + } + state["instance"] = s.instance return multistep.ActionContinue diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index 996d51492..837fcdc68 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -91,6 +91,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe VpcId: b.config.VpcId, }, &awscommon.StepRunSourceInstance{ + Debug: b.config.PackerDebug, ExpectedRootDevice: "ebs", InstanceType: b.config.InstanceType, UserData: b.config.UserData, diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index 2b1e236c7..6d1ce15e6 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -194,6 +194,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe VpcId: b.config.VpcId, }, &awscommon.StepRunSourceInstance{ + Debug: b.config.PackerDebug, ExpectedRootDevice: "instance-store", InstanceType: b.config.InstanceType, IamInstanceProfile: b.config.IamInstanceProfile,