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

Prevent using user name with bitbucket_repository_user_permission. Must be UUID. #209

Merged
Changes from all commits
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
4 changes: 4 additions & 0 deletions bitbucket/resource_repository_user_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func resourceRepositoryUserPermissionPut(ctx context.Context, d *schema.Resource
d.SetId(fmt.Sprintf("%s:%s:%s", workspace, repoSlug, userSlug))
}

if userSlug != permission.User.UUID {
return diag.FromErr(fmt.Errorf("The user_id must be a UUID, but a user name was given (\"%s\"). The UUID for this user is \"%s\".", userSlug, permission.User.UUID))
Copy link
Author

Choose a reason for hiding this comment

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

For convenience, the error message includes the UUID of the user, to make it easy to update the incorrect user_id.

}

return resourceRepositoryUserPermissionRead(ctx, d, m)
}

Expand Down
Loading