|
|
|
|
@ -47,7 +47,7 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
|
|
|
|
|
// Retrieve the instance ID from the previously saved state.
|
|
|
|
|
instanceID, ok := state.Get("instance_id").(string)
|
|
|
|
|
if !ok || instanceID == "" {
|
|
|
|
|
ui.Error("Could not retrieve instance_id from state!")
|
|
|
|
|
state.Put("error", fmt.Errorf("Could not retrieve instance_id from state!"))
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -56,7 +56,7 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
|
|
|
|
|
cloudstack.WithProject(config.Project),
|
|
|
|
|
)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ui.Error(fmt.Sprintf("Failed to retrieve the network object: %s", err))
|
|
|
|
|
state.Put("error", fmt.Errorf("Failed to retrieve the network object: %s", err))
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -79,7 +79,7 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
|
|
|
|
|
// Associate a new public IP address.
|
|
|
|
|
ipAddr, err := client.Address.AssociateIpAddress(p)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ui.Error(fmt.Sprintf("Failed to associate public IP address: %s", err))
|
|
|
|
|
state.Put("error", fmt.Errorf("Failed to associate public IP address: %s", err))
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -117,7 +117,7 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
|
|
|
|
|
ui.Message("Creating network ACL rule...")
|
|
|
|
|
|
|
|
|
|
if network.Aclid == "" {
|
|
|
|
|
ui.Error("Failed to configure the firewall: no ACL connected to the VPC network")
|
|
|
|
|
state.Put("error", fmt.Errorf("Failed to configure the firewall: no ACL connected to the VPC network"))
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -135,7 +135,7 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
|
|
|
|
|
// Create the network ACL rule.
|
|
|
|
|
aclRule, err := client.NetworkACL.CreateNetworkACL(p)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ui.Error(fmt.Sprintf("Failed to create network ACL rule: %s", err))
|
|
|
|
|
state.Put("error", fmt.Errorf("Failed to create network ACL rule: %s", err))
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -154,7 +154,7 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
|
|
|
|
|
|
|
|
|
|
fwRule, err := client.Firewall.CreateFirewallRule(p)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ui.Error(fmt.Sprintf("Failed to create firewall rule: %s", err))
|
|
|
|
|
state.Put("error", fmt.Errorf("Failed to create firewall rule: %s", err))
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|