From f4020835d609f3a4408d1b2ffd209aee8a0313e5 Mon Sep 17 00:00:00 2001 From: Sergio Millan Rodriguez Date: Mon, 16 Jul 2018 13:06:51 +0200 Subject: [PATCH] flag to setup networking without firewall rules --- builder/cloudstack/config.go | 43 +++++++++---------- .../cloudstack/step_configure_networking.go | 9 +++- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/builder/cloudstack/config.go b/builder/cloudstack/config.go index b0c338272..3d15d27a2 100644 --- a/builder/cloudstack/config.go +++ b/builder/cloudstack/config.go @@ -27,28 +27,27 @@ type Config struct { HTTPGetOnly bool `mapstructure:"http_get_only"` SSLNoVerify bool `mapstructure:"ssl_no_verify"` - CIDRList []string `mapstructure:"cidr_list"` - CreateSecurityGroup bool `mapstructure:"create_security_group"` - DiskOffering string `mapstructure:"disk_offering"` - DiskSize int64 `mapstructure:"disk_size"` - Expunge bool `mapstructure:"expunge"` - Hypervisor string `mapstructure:"hypervisor"` - InstanceName string `mapstructure:"instance_name"` - Keypair string `mapstructure:"keypair"` - Network string `mapstructure:"network"` - Project string `mapstructure:"project"` - PublicIPAddress string `mapstructure:"public_ip_address"` - SecurityGroups []string `mapstructure:"security_groups"` - ServiceOffering string `mapstructure:"service_offering"` - CreateNetworkACL bool `mapstructure:"create_network_acl"` - CreateFirewallRule bool `mapstructure:"create_firewall_rule"` - SourceISO string `mapstructure:"source_iso"` - SourceTemplate string `mapstructure:"source_template"` - TemporaryKeypairName string `mapstructure:"temporary_keypair_name"` - UseLocalIPAddress bool `mapstructure:"use_local_ip_address"` - UserData string `mapstructure:"user_data"` - UserDataFile string `mapstructure:"user_data_file"` - Zone string `mapstructure:"zone"` + CIDRList []string `mapstructure:"cidr_list"` + CreateSecurityGroup bool `mapstructure:"create_security_group"` + DiskOffering string `mapstructure:"disk_offering"` + DiskSize int64 `mapstructure:"disk_size"` + Expunge bool `mapstructure:"expunge"` + Hypervisor string `mapstructure:"hypervisor"` + InstanceName string `mapstructure:"instance_name"` + Keypair string `mapstructure:"keypair"` + Network string `mapstructure:"network"` + Project string `mapstructure:"project"` + PublicIPAddress string `mapstructure:"public_ip_address"` + SecurityGroups []string `mapstructure:"security_groups"` + ServiceOffering string `mapstructure:"service_offering"` + PreventFirewallChanges bool `mapstructure:"prevent_firewall_changes"` + SourceISO string `mapstructure:"source_iso"` + SourceTemplate string `mapstructure:"source_template"` + TemporaryKeypairName string `mapstructure:"temporary_keypair_name"` + UseLocalIPAddress bool `mapstructure:"use_local_ip_address"` + UserData string `mapstructure:"user_data"` + UserDataFile string `mapstructure:"user_data_file"` + Zone string `mapstructure:"zone"` TemplateName string `mapstructure:"template_name"` TemplateDisplayText string `mapstructure:"template_display_text"` diff --git a/builder/cloudstack/step_configure_networking.go b/builder/cloudstack/step_configure_networking.go index ccda39107..577b4b1f2 100644 --- a/builder/cloudstack/step_configure_networking.go +++ b/builder/cloudstack/step_configure_networking.go @@ -117,7 +117,12 @@ func (s *stepSetupNetworking) Run(_ context.Context, state multistep.StateBag) m // Store the port forward ID. state.Put("port_forward_id", forward.Id) - if network.Vpcid != "" && config.CreateNetworkACL { + if config.PreventFirewallChanges { + ui.Message("Networking has been setup (without firewall changes)!") + return multistep.ActionContinue + } + + if network.Vpcid != "" { ui.Message("Creating network ACL rule...") if network.Aclid == "" { @@ -149,7 +154,7 @@ func (s *stepSetupNetworking) Run(_ context.Context, state multistep.StateBag) m // Store the network ACL rule ID. state.Put("network_acl_rule_id", aclRule.Id) - } else if config.CreateFirewallRule { + } else { ui.Message("Creating firewall rule...") // Create a new parameter struct.