diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-02 11:39:41 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-02 11:39:41 +0200 |
commit | 5c1feb2c5fe3962a8c5c1caffb81d6526eedf992 (patch) | |
tree | 32abbec2dd6fe4d0f12a3522b3e1b797ba187c1e | |
parent | 4457c936d2e052d63af049e4fb6c649a6d236638 (diff) | |
download | terraform-provider-mailgun-5c1feb2c5fe3962a8c5c1caffb81d6526eedf992.tar.gz terraform-provider-mailgun-5c1feb2c5fe3962a8c5c1caffb81d6526eedf992.tar.zst terraform-provider-mailgun-5c1feb2c5fe3962a8c5c1caffb81d6526eedf992.zip |
fix issue read
-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{}) |