Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/datadog: make datadog_user verified a computed attribute #15034

Merged
merged 2 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions builtin/providers/datadog/resource_datadog_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"strings"

"github.com/davecgh/go-spew/spew"
"github.com/hashicorp/terraform/helper/schema"
"gopkg.in/zorkian/go-datadog-api.v2"
)
Expand Down Expand Up @@ -49,7 +50,7 @@ func resourceDatadogUser() *schema.Resource {
},
"verified": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
},
}
Expand Down Expand Up @@ -96,7 +97,7 @@ func resourceDatadogUserCreate(d *schema.ResourceData, meta interface{}) error {

d.SetId(u.GetHandle())

return nil
return resourceDatadogUserRead(d, meta)
}

func resourceDatadogUserRead(d *schema.ResourceData, meta interface{}) error {
Expand All @@ -107,7 +108,7 @@ func resourceDatadogUserRead(d *schema.ResourceData, meta interface{}) error {
return err
}

log.Printf("[DEBUG] user: %v", u)
log.Printf("[DEBUG] user: %s", spew.Sdump(u))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the spew.Dump here? Think this is debug work ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only left it in as the #v output is useless - it's just a bunch of memory addresses. Should we remove the entire line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the entire debug line as it's pretty much useless :) <3 for the fixing of the debug though

d.Set("disabled", u.GetDisabled())
d.Set("email", u.GetEmail())
d.Set("handle", u.GetHandle())
Expand Down
4 changes: 4 additions & 0 deletions builtin/providers/datadog/resource_datadog_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func TestAccDatadogUser_Updated(t *testing.T) {
"datadog_user.foo", "handle", "[email protected]"),
resource.TestCheckResourceAttr(
"datadog_user.foo", "name", "Test User"),
resource.TestCheckResourceAttr(
"datadog_user.foo", "verified", "false"),
),
},
resource.TestStep{
Expand All @@ -42,6 +44,8 @@ func TestAccDatadogUser_Updated(t *testing.T) {
"datadog_user.foo", "is_admin", "true"),
resource.TestCheckResourceAttr(
"datadog_user.foo", "name", "Updated User"),
resource.TestCheckResourceAttr(
"datadog_user.foo", "verified", "false"),
),
},
},
Expand Down