diff --git a/docs/resources/user.md b/docs/resources/user.md index 100d940..f5d877f 100644 --- a/docs/resources/user.md +++ b/docs/resources/user.md @@ -31,6 +31,7 @@ resource "looker_user" "user" { - `first_name` (String) - `id` (String) The ID of this resource. +- `is_disabled` (Boolean) - `last_name` (String) diff --git a/pkg/looker/resource_user.go b/pkg/looker/resource_user.go index 19fd784..2981558 100644 --- a/pkg/looker/resource_user.go +++ b/pkg/looker/resource_user.go @@ -33,6 +33,10 @@ func resourceUser() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "is_disabled": { + Type: schema.TypeBool, + Optional: true, + }, }, } } @@ -42,10 +46,12 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, m interface firstName := d.Get("first_name").(string) lastName := d.Get("last_name").(string) email := d.Get("email").(string) + isDisabled := d.Get("is_disabled").(bool) writeUser := apiclient.WriteUser{ - FirstName: &firstName, - LastName: &lastName, + FirstName: &firstName, + LastName: &lastName, + IsDisabled: &isDisabled, } // CreateUser sometimes returns 500 error @@ -104,6 +110,9 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, m interface{} if err = d.Set("last_name", user.LastName); err != nil { return diag.FromErr(err) } + if err = d.Set("is_disabled", user.IsDisabled); err != nil { + return diag.FromErr(err) + } return nil } @@ -113,12 +122,14 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, m interface userID := d.Id() - if d.HasChanges("first_name", "last_name") { + if d.HasChanges("first_name", "last_name", "is_disabled") { firstName := d.Get("first_name").(string) lastName := d.Get("last_name").(string) + isDisabled := d.Get("is_disabled").(bool) writeUser := apiclient.WriteUser{ - FirstName: &firstName, - LastName: &lastName, + FirstName: &firstName, + LastName: &lastName, + IsDisabled: &isDisabled, } _, err := client.UpdateUser(userID, writeUser, "", nil) if err != nil {