diff --git a/builder/cloudstack/step_configure_networking.go b/builder/cloudstack/step_configure_networking.go index 2aa071905..634b6dcf8 100644 --- a/builder/cloudstack/step_configure_networking.go +++ b/builder/cloudstack/step_configure_networking.go @@ -73,6 +73,10 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction p.SetNetworkid(network.Id) } + if config.Zone != "" { + p.SetZoneid(config.Zone) + } + // Associate a new public IP address. ipAddr, err := client.Address.AssociateIpAddress(p) if err != nil { @@ -125,8 +129,8 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction p.SetAclid(network.Aclid) p.SetAction("allow") p.SetCidrlist(config.CIDRList) - p.SetStartport(s.privatePort) - p.SetEndport(s.privatePort) + p.SetStartport(s.publicPort) + p.SetEndport(s.publicPort) p.SetTraffictype("ingress") // Create the network ACL rule. @@ -146,8 +150,8 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction // Configure the firewall rule. p.SetCidrlist(config.CIDRList) - p.SetStartport(s.privatePort) - p.SetEndport(s.privatePort) + p.SetStartport(s.publicPort) + p.SetEndport(s.publicPort) fwRule, err := client.Firewall.CreateFirewallRule(p) if err != nil { diff --git a/builder/cloudstack/step_create_instance.go b/builder/cloudstack/step_create_instance.go index e09e6e16b..7c8103899 100644 --- a/builder/cloudstack/step_create_instance.go +++ b/builder/cloudstack/step_create_instance.go @@ -60,6 +60,10 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction p.SetProjectid(config.Project) } + if config.Keypair != "" { + p.SetKeypair(config.Keypair) + } + if config.UserData != "" { ud, err := getUserData(config.UserData, config.HTTPGetOnly) if err != nil {