terraform-provider-sentry icon indicating copy to clipboard operation
terraform-provider-sentry copied to clipboard

How to add member to a team

Open rngtng opened this issue 6 years ago • 13 comments

Hey! Thanks a lot for your sentry terraform provider - great stuff. I managed to setup a team. But unfortunately I couldn't figure out how to add member to it. Reading code I couldn't find anything. So am I right this isn't currently supported? Could you give me some hints, I'm happy to implement it!

rngtng avatar Jan 03 '18 09:01 rngtng

@rngtng it doesn’t look like sentry api supports user management (unless I missed it): https://docs.sentry.io/api/

Until that happens there isn’t really a way to do it with Tf.

mwarkentin avatar Jan 03 '18 12:01 mwarkentin

Oh you got a point there :) I thought they would support it - Bummer :(

rngtng avatar Jan 03 '18 12:01 rngtng

There's only a get endpoint https://github.com/getsentry/sentry/blob/c212a9a0e0dc5342e9aa580c953492091b69114c/src/sentry/api/endpoints/team_members.py, but indeed no post :(

Weird this endpoint isn't event documented..

rngtng avatar Jan 03 '18 12:01 rngtng

hm but what is this: https://github.com/getsentry/sentry/pull/6445 see https://github.com/getsentry/sentry/blob/master/src/sentry/api/endpoints/organization_member_details.py#L133 -> it takes a teams value? I need to dig deeper into code.. sigh

rngtng avatar Jan 03 '18 12:01 rngtng

Looks like that allows you to add members to teams, but not create, as far as I can tell. There's also this: https://github.com/getsentry/sentry/blob/master/src/sentry/api/endpoints/user_details.py#L67-L91

However that also looks like just an update of an existing user rather than create? Might be worth opening a support ticket w/ Sentry or something to ask.

mwarkentin avatar Jan 03 '18 13:01 mwarkentin

Asked on the #sentry forum: https://forum.sentry.io/t/api-how-to-create-add-member-to-a-team/2956

Just adding members to team would already help us, as in our current setup, member self-signup via the github integration.

rngtng avatar Jan 04 '18 22:01 rngtng

Sorry for bumping a very old thread, but I'm new to the Sentry API. Does this code mean that this is now (or could now be) supported? https://github.com/getsentry/sentry/blob/master/src/sentry/api/endpoints/organization_member_index.py#L168

evancharlton avatar Mar 23 '20 21:03 evancharlton

Sorry for bumping a very old thread, but I'm new to the Sentry API. Does this code mean that this is now (or could now be) supported? https://github.com/getsentry/sentry/blob/master/src/sentry/api/endpoints/organization_member_index.py#L168

This doesn't appear to really give you the semantics you'd want out of a construct for assigning and reassigning team membership. Basically this acts first and foremost as a means to invite someone to the organization and as a secondary concern assigning teams. Once you've called this action once, subsequent calls yield a 409 indicating that the member already exists (in the organization). What I think we're all after is something that allows you to easily manage team member assignments in an ad-hoc fashion.

agershman avatar Apr 16 '20 04:04 agershman

Would also be very interested in this! Any viable workarounds?

jareware avatar Sep 29 '20 05:09 jareware

@jareware did you find anything here? @jianyuan are you tracking this / looking to add this functionality in the future if / when Sentry does support it?

Gowiem avatar Dec 28 '20 23:12 Gowiem

@Gowiem sadly no, ended up just doing this outside Terraform. 😕

jareware avatar Feb 26 '21 14:02 jareware

It looks like there is now a Beta for SCIM support, which appears to include adding members to a team Sentry API SCIM (Beta)

bcdady avatar May 01 '22 02:05 bcdady

Would https://github.com/jianyuan/terraform-provider-sentry/pull/138 solve this?

Skeen avatar Jun 16 '22 12:06 Skeen

This is now possible since v0.10.0.

jianyuan avatar Nov 02 '22 23:11 jianyuan

Hi @jianyuan :). Do you have any plans to allow to add the possibility to add already existing organization member to a team? the provided sentry_organization_member requires to have a token with Owner role since it is mean to add a member to the organization, but I am looking for the way to add already existing organization members into a team, this requires only Admin role. If not. could you give me some hints on how to start working on that? I'm happy to contribute! by inspecting the request fron sentry ui i see it POST to https://sentry.io/api/0/organizations/{my-organization}/members/{member-id-to-be-added}/teams/{my-team}/

lpgarzonr avatar Dec 08 '22 16:12 lpgarzonr

@jianyuan We have LDAP integration, and a user is automatically added to the org. And there is no possibility to add the user to the team via terraform. Performing import for each user doesn't look good to me

Tonkonozhenko avatar Jan 05 '23 10:01 Tonkonozhenko