flag to setup networking without firewall rules

This commit is contained in:
Sergio Millan Rodriguez 2018-07-16 13:06:51 +02:00
parent 472a7820eb
commit f4020835d6
2 changed files with 28 additions and 24 deletions

View File

@ -40,8 +40,7 @@ type Config struct {
PublicIPAddress string `mapstructure:"public_ip_address"` PublicIPAddress string `mapstructure:"public_ip_address"`
SecurityGroups []string `mapstructure:"security_groups"` SecurityGroups []string `mapstructure:"security_groups"`
ServiceOffering string `mapstructure:"service_offering"` ServiceOffering string `mapstructure:"service_offering"`
CreateNetworkACL bool `mapstructure:"create_network_acl"` PreventFirewallChanges bool `mapstructure:"prevent_firewall_changes"`
CreateFirewallRule bool `mapstructure:"create_firewall_rule"`
SourceISO string `mapstructure:"source_iso"` SourceISO string `mapstructure:"source_iso"`
SourceTemplate string `mapstructure:"source_template"` SourceTemplate string `mapstructure:"source_template"`
TemporaryKeypairName string `mapstructure:"temporary_keypair_name"` TemporaryKeypairName string `mapstructure:"temporary_keypair_name"`

View File

@ -117,7 +117,12 @@ func (s *stepSetupNetworking) Run(_ context.Context, state multistep.StateBag) m
// Store the port forward ID. // Store the port forward ID.
state.Put("port_forward_id", 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...") ui.Message("Creating network ACL rule...")
if network.Aclid == "" { if network.Aclid == "" {
@ -149,7 +154,7 @@ func (s *stepSetupNetworking) Run(_ context.Context, state multistep.StateBag) m
// Store the network ACL rule ID. // Store the network ACL rule ID.
state.Put("network_acl_rule_id", aclRule.Id) state.Put("network_acl_rule_id", aclRule.Id)
} else if config.CreateFirewallRule { } else {
ui.Message("Creating firewall rule...") ui.Message("Creating firewall rule...")
// Create a new parameter struct. // Create a new parameter struct.