diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-08 17:57:18 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-08 17:57:18 +0200 |
commit | b8802d62b2dcaad11d846bde7306b74f49263e5e (patch) | |
tree | 57d42534000bfd9b7f1f73a3af62343d4a3a94a3 /mailgun | |
parent | 96cd61e152de23fd789a0739dd63f48b333a0be0 (diff) | |
download | terraform-provider-mailgun-b8802d62b2dcaad11d846bde7306b74f49263e5e.tar.gz terraform-provider-mailgun-b8802d62b2dcaad11d846bde7306b74f49263e5e.tar.zst terraform-provider-mailgun-b8802d62b2dcaad11d846bde7306b74f49263e5e.zip |
change import function to avoid setting default in read
Diffstat (limited to 'mailgun')
-rw-r--r-- | mailgun/resource_mailgun_domain.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/mailgun/resource_mailgun_domain.go b/mailgun/resource_mailgun_domain.go index 8ba0704..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{ |
@@ -375,13 +375,6 @@ func ReadDomain(d *schema.ResourceData, meta interface{}) error { | |||
375 | if err != nil { | 375 | if err != nil { |
376 | return fmt.Errorf("Error Getting mailgun domain Details for %s: Error: %s", d.Id(), err) | 376 | return fmt.Errorf("Error Getting mailgun domain Details for %s: Error: %s", d.Id(), err) |
377 | } | 377 | } |
378 | if _, ok := d.GetOk("dkim_key_size"); !ok { | ||
379 | d.Set("dkim_key_size", 1024) | ||
380 | } | ||
381 | |||
382 | if _, ok := d.GetOk("force_dkim_authority"); !ok { | ||
383 | d.Set("force_dkim_authority", false) | ||
384 | } | ||
385 | 378 | ||
386 | d.Set("created_at", domainResponse.Domain.CreatedAt) | 379 | d.Set("created_at", domainResponse.Domain.CreatedAt) |
387 | d.Set("smtd_login", domainResponse.Domain.SMTPLogin) | 380 | d.Set("smtd_login", domainResponse.Domain.SMTPLogin) |
@@ -489,3 +482,14 @@ func ListCredentials(domain, apiKey string) ([]mailgun.Credential, error) { | |||
489 | } | 482 | } |
490 | return result, nil | 483 | return result, nil |
491 | } | 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 | } | ||