Skip to content

Commit

Permalink
restore skip_welcome_email in User resource (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
Taimoor Ahmad authored Jan 3, 2024
1 parent 6075b40 commit 9453989
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .changes/unreleased/Removed-20240103-122630.yaml

This file was deleted.

15 changes: 13 additions & 2 deletions opslevel/resource_opslevel_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,26 @@ func resourceUser() *schema.Resource {
Optional: true,
ValidateFunc: validation.StringInSlice(opslevel.AllUserRole, false),
},
// There is no way to read this value from a User resource and no way
// to set it in the terraform state. Do not remove it because some
// customers rely on this feature regardless.
"skip_welcome_email": {
Type: schema.TypeBool,
Description: "Don't send an email welcoming the user to OpsLevel. Applies during creation only, this value cannot be read or updated.",
Default: false,
ForceNew: false,
Optional: true,
},
},
}
}

func resourceUserCreate(d *schema.ResourceData, client *opslevel.Client) error {
email := d.Get("email").(string)
input := opslevel.UserInput{
Name: d.Get("name").(string),
Role: opslevel.UserRole(d.Get("role").(string)),
Name: d.Get("name").(string),
Role: opslevel.UserRole(d.Get("role").(string)),
SkipWelcomeEmail: d.Get("skip_welcome_email").(bool),
}
resource, err := client.InviteUser(email, input)
if err != nil {
Expand Down

0 comments on commit 9453989

Please sign in to comment.