diff --git a/builder/cloudstack/config.go b/builder/cloudstack/config.go index 98292ccfd..a01d66eb7 100644 --- a/builder/cloudstack/config.go +++ b/builder/cloudstack/config.go @@ -38,7 +38,7 @@ type Config struct { Network string `mapstructure:"network"` Project string `mapstructure:"project"` PublicIPAddress string `mapstructure:"public_ip_address"` - PublicSSHPort int `mapstructure:"public_ssh_port"` + PublicPort int `mapstructure:"public_port"` SecurityGroups []string `mapstructure:"security_groups"` ServiceOffering string `mapstructure:"service_offering"` PreventFirewallChanges bool `mapstructure:"prevent_firewall_changes"` diff --git a/builder/cloudstack/step_configure_networking.go b/builder/cloudstack/step_configure_networking.go index 8b628b0ff..39636b54f 100644 --- a/builder/cloudstack/step_configure_networking.go +++ b/builder/cloudstack/step_configure_networking.go @@ -31,8 +31,8 @@ func (s *stepSetupNetworking) Run(_ context.Context, state multistep.StateBag) m return multistep.ActionContinue } - if config.PublicSSHPort != 0 { - s.publicPort = config.PublicSSHPort + if config.PublicPort != 0 { + s.publicPort = config.PublicPort } else { // Generate a random public port used to configure our port forward. rand.Seed(time.Now().UnixNano()) diff --git a/website/source/docs/builders/cloudstack.html.md b/website/source/docs/builders/cloudstack.html.md index 3de58d85f..be87cc86c 100644 --- a/website/source/docs/builders/cloudstack.html.md +++ b/website/source/docs/builders/cloudstack.html.md @@ -126,7 +126,7 @@ builder. connecting any provisioners to. If not provided, a temporary public IP address will be associated and released during the Packer run. -- `public_ssh_port` (number) - The fixed port you want to configure in the port +- `public_port` (number) - The fixed port you want to configure in the port forwarding rule. Set this attribute if you do not want to use the a random public port.