Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While creating a DL Connect gateway do not wait for gateway to be provisioned for few providers #2458

Merged
merged 2 commits into from
Apr 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ibm/resource_ibm_dl_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"log"
"os"
"strings"
"time"

"github.com/IBM/networking-go-sdk/directlinkv1"
Expand Down Expand Up @@ -541,10 +542,20 @@ func resourceIBMdlGatewayCreate(d *schema.ResourceData, meta interface{}) error

log.Printf("[INFO] Created Direct Link Gateway (%s Template) : %s", dtype, *gateway.ID)
if dtype == "connect" {
_, err = isWaitForDirectLinkAvailable(directLink, d.Id(), d.Timeout(schema.TimeoutCreate))
getPortOptions := directLink.NewGetPortOptions(*gateway.Port.ID)
port, response, err := directLink.GetPort(getPortOptions)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err != nil || response != nil || port != nil

so that we are safe to handle the condition if port is nil by any chance

log.Println("[WARN] Error getting port", response, err)
return err
}

if !strings.Contains(strings.ToLower(*port.ProviderName), "netbond") && !strings.Contains(strings.ToLower(*port.ProviderName), "megaport") {
_, err = isWaitForDirectLinkAvailable(directLink, d.Id(), d.Timeout(schema.TimeoutCreate))
if err != nil {
return err
}
}

}

v := os.Getenv("IC_ENV_TAGS")
Expand Down