diff options
-rw-r--r-- | mailgun/resource_mailgun_domain.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mailgun/resource_mailgun_domain.go b/mailgun/resource_mailgun_domain.go index 028c99f..eaf00fa 100644 --- a/mailgun/resource_mailgun_domain.go +++ b/mailgun/resource_mailgun_domain.go | |||
@@ -360,8 +360,8 @@ func ReadDomain(d *schema.ResourceData, meta interface{}) error { | |||
360 | mg := meta.(*mailgun.MailgunImpl) | 360 | mg := meta.(*mailgun.MailgunImpl) |
361 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) | 361 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) |
362 | defer cancel() | 362 | defer cancel() |
363 | |||
364 | domainName := d.Get("name").(string) | 363 | domainName := d.Get("name").(string) |
364 | mg = mailgun.NewMailgun(domainName, mg.APIKey()) | ||
365 | 365 | ||
366 | domainResponse, err := mg.GetDomain(ctx, domainName) | 366 | domainResponse, err := mg.GetDomain(ctx, domainName) |
367 | if err != nil { | 367 | if err != nil { |
@@ -429,6 +429,10 @@ func ReadDomain(d *schema.ResourceData, meta interface{}) error { | |||
429 | d.Set("ips", ips) | 429 | d.Set("ips", ips) |
430 | 430 | ||
431 | credentialsResponse, err := ListCredentials(domainName, mg.APIKey()) | 431 | credentialsResponse, err := ListCredentials(domainName, mg.APIKey()) |
432 | if err != nil { | ||
433 | return fmt.Errorf("Error Getting mailgun credentials for %s: Error: %s", d.Id(), err) | ||
434 | } | ||
435 | |||
432 | credentials := make([]map[string]interface{}, len(credentialsResponse)) | 436 | credentials := make([]map[string]interface{}, len(credentialsResponse)) |
433 | for i, r := range credentialsResponse { | 437 | for i, r := range credentialsResponse { |
434 | credentials[i] = make(map[string]interface{}) | 438 | credentials[i] = make(map[string]interface{}) |