diff options
Diffstat (limited to 'mailgun/resource_mailgun_domain.go')
-rw-r--r-- | mailgun/resource_mailgun_domain.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mailgun/resource_mailgun_domain.go b/mailgun/resource_mailgun_domain.go index 1fcba83..86531c6 100644 --- a/mailgun/resource_mailgun_domain.go +++ b/mailgun/resource_mailgun_domain.go | |||
@@ -16,7 +16,7 @@ func resourceMailgunDomain() *schema.Resource { | |||
16 | Delete: DeleteDomain, | 16 | Delete: DeleteDomain, |
17 | Read: ReadDomain, | 17 | Read: ReadDomain, |
18 | Importer: &schema.ResourceImporter{ | 18 | Importer: &schema.ResourceImporter{ |
19 | State: schema.ImportStatePassthrough, | 19 | State: ImportStatePassthroughDomain, |
20 | }, | 20 | }, |
21 | 21 | ||
22 | Schema: map[string]*schema.Schema{ | 22 | Schema: map[string]*schema.Schema{ |
@@ -368,7 +368,7 @@ func ReadDomain(d *schema.ResourceData, meta interface{}) error { | |||
368 | mg := meta.(*mailgun.MailgunImpl) | 368 | mg := meta.(*mailgun.MailgunImpl) |
369 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) | 369 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) |
370 | defer cancel() | 370 | defer cancel() |
371 | domainName := d.Get("name").(string) | 371 | domainName := d.Id() |
372 | mg = mailgun.NewMailgun(domainName, mg.APIKey()) | 372 | mg = mailgun.NewMailgun(domainName, mg.APIKey()) |
373 | 373 | ||
374 | domainResponse, err := mg.GetDomain(ctx, domainName) | 374 | domainResponse, err := mg.GetDomain(ctx, domainName) |
@@ -482,3 +482,14 @@ func ListCredentials(domain, apiKey string) ([]mailgun.Credential, error) { | |||
482 | } | 482 | } |
483 | return result, nil | 483 | return result, nil |
484 | } | 484 | } |
485 | |||
486 | func ImportStatePassthroughDomain(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { | ||
487 | if _, ok := d.GetOk("dkim_key_size"); !ok { | ||
488 | d.Set("dkim_key_size", 1024) | ||
489 | } | ||
490 | |||
491 | if _, ok := d.GetOk("force_dkim_authority"); !ok { | ||
492 | d.Set("force_dkim_authority", false) | ||
493 | } | ||
494 | return []*schema.ResourceData{d}, nil | ||
495 | } | ||