Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:yieldr/terraform-provider-auth0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkappa committed Jun 1, 2018
2 parents a40bcb3 + 0e2abba commit f26faf8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions auth0/resource_auth0_custom_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ func createCustomDomain(d *schema.ResourceData, m interface{}) error {
return err
}
d.SetId(c.ID)
verification := []map[string]interface{}{
{"methods": c.Verification.Methods},
}
if err := d.Set("verification", verification); err != nil {
return err
}
return nil
return readCustomDomain(d, m)
}

func readCustomDomain(d *schema.ResourceData, m interface{}) error {
Expand All @@ -84,6 +78,13 @@ func readCustomDomain(d *schema.ResourceData, m interface{}) error {
return err
}
d.SetId(c.ID)
d.Set("domain", c.Domain)
d.Set("type", c.Type)
d.Set("primary", c.Primary)
d.Set("status", c.Status)
d.Set("verification", []map[string]interface{}{
{"methods": c.Verification.Methods},
})
return nil
}

Expand All @@ -95,7 +96,7 @@ func updateCustomDomain(d *schema.ResourceData, m interface{}) error {
if err != nil {
return err
}
return nil
return readCustomDomain(d, m)
}

func deleteCustomDomain(d *schema.ResourceData, m interface{}) error {
Expand All @@ -104,12 +105,9 @@ func deleteCustomDomain(d *schema.ResourceData, m interface{}) error {
}

func buildCustomDomain(d *schema.ResourceData) *management.CustomDomain {

c := &management.CustomDomain{
return &management.CustomDomain{
Domain: d.Get("domain").(string),
Type: d.Get("type").(string),
VerificationMethod: d.Get("verification_method").(string),
}

return c
}
2 changes: 1 addition & 1 deletion auth0/resource_auth0_custom_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestAccCustomDomain(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_custom_domain.my_custom_domain", "domain", "auth.example.com"),
resource.TestCheckResourceAttr("auth0_custom_domain.my_custom_domain", "type", "auth0_managed_certs"),
resource.TestCheckResourceAttr("auth0_custom_domain.my_custom_domain", "verification_method", "txt"),
resource.TestCheckResourceAttr("auth0_custom_domain.my_custom_domain", "status", "pending_verification"),
),
},
},
Expand Down

0 comments on commit f26faf8

Please sign in to comment.