package oci

import (
	"context"
	"fmt"

	"github.com/hashicorp/packer/helper/multistep"
	"github.com/hashicorp/packer/packer"
)

type stepInstanceInfo struct{}

func (s *stepInstanceInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
	var (
		driver = state.Get("driver").(Driver)
		ui     = state.Get("ui").(packer.Ui)
		id     = state.Get("instance_id").(string)
	)

	ip, err := driver.GetInstanceIP(id)
	if err != nil {
		err = fmt.Errorf("Error getting instance's IP: %s", err)
		ui.Error(err.Error())
		state.Put("error", err)
		return multistep.ActionHalt
	}

	state.Put("instance_ip", ip)

	ui.Say(fmt.Sprintf("Instance has IP: %s.", ip))

	return multistep.ActionContinue
}

func (s *stepInstanceInfo) Cleanup(state multistep.StateBag) {
	// no cleanup
}

package oci

import (
	"context"
	"fmt"

	"github.com/hashicorp/packer/helper/multistep"
	"github.com/hashicorp/packer/packer"
)

type stepInstanceInfo struct{}

func (s *stepInstanceInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
	var (
		driver = state.Get("driver").(Driver)
		ui     = state.Get("ui").(packer.Ui)
		id     = state.Get("instance_id").(string)
	)

	ip, err := driver.GetInstanceIP(id)
	if err != nil {
		err = fmt.Errorf("Error getting instance's public IP: %s", err)
		ui.Error(err.Error())
		state.Put("error", err)
		return multistep.ActionHalt
	}

	state.Put("instance_ip", ip)

	ui.Say(fmt.Sprintf("Instance has public IP: %s.", ip))

	return multistep.ActionContinue
}

func (s *stepInstanceInfo) Cleanup(state multistep.StateBag) {
	// no cleanup
}

--- 
+++ 
@@ -19,7 +19,7 @@
 
 	ip, err := driver.GetInstanceIP(id)
 	if err != nil {
-		err = fmt.Errorf("Error getting instance's public IP: %s", err)
+		err = fmt.Errorf("Error getting instance's IP: %s", err)
 		ui.Error(err.Error())
 		state.Put("error", err)
 		return multistep.ActionHalt
@@ -27,7 +27,7 @@
 
 	state.Put("instance_ip", ip)
 
-	ui.Say(fmt.Sprintf("Instance has public IP: %s.", ip))
+	ui.Say(fmt.Sprintf("Instance has IP: %s.", ip))
 
 	return multistep.ActionContinue
 }
Update logs to talk about IP instead of public IP

When logging we don't know whether we use a private or public ip, just
the ip itself.
