jianyuan / terraform-provider-sentry

Terraform provider for Sentry
https://registry.terraform.io/providers/jianyuan/sentry/latest
MIT License
327 stars 128 forks source link

Unable to update users #312

Open diraven opened 1 year ago

diraven commented 1 year ago

Provider seems to be using outdated endpoint method for updating users: PUT https://sentry.io/api/0/organizations/{org}/members/{member_id} (https://github.com/jianyuan/go-sentry/blob/main/sentry/organization_members.go#L101)

Which is nowhere to be seen in the official documentation: https://docs.sentry.io/api/organizations/

Sentry.io seems to have switched to using SCIM for user/team management: https://docs.sentry.io/api/scim/

I'm unsure when exactly did the switch happen, but it does not seem to be possible to update users with terraform any more: any attempt to update user through the provider leads to 400 error.

Any pointers? Am I missing something important?

ericksprengel commented 8 months ago

I'm receiving the an error too.

Client Error
╷
│ Error: Client Error
│ 
│   with sentry_team_member.george_banana,
│   on team_platform_interaction.tf line 19, in resource "sentry_team_member" "george_banana":
│   19: resource "sentry_team_member" "george_banana" {
│ 
│ unable to update organization member's team role, got error: PUT https://sentry.io/api/0/organizations/ericksprengel/members/11111111/: 400
│ map[role:[You do not have permission to set that org-level role] teamRoles:[Invalid team-role]]
╵

when creating an user with terraform I got an error too.

Can anyone create a sentry_team_member using terraform without errors?

jianyuan commented 8 months ago

Hi @ericksprengel, what team role options do you see when you visit the team members' settings page?

Conzar commented 8 months ago

I am also getting this error:

 Unable to read team member, got error: unable to update organization
│ member's team role, got error: PUT
│ https://SENTRY_URL/api/0/organizations/spm/members/2/: 400
│ map[teamRoles:[Invalid team-role]]

However, the user is added to the team with the 'admin' role which is what I specified.

tokyowizard commented 8 months ago

Hi @jianyuan,

what team role options do you see when you visit the team members' settings page?

We're on the Team plan https://sentry.io/pricing/ and I see this:

Screenshot 2024-01-16 at 10 27 38

I cannot change the roles. Clicking on the pull down menu for Contributor does not respond.

I'm also getting the same error:

│ unable to update organization member's team role, got error: PUT
│ https://sentry.io/api/0/organizations/[redact org name]/members/[redact member id]/: 400
│ map[role:[You do not have permission to set that org-level role]
│ teamRoles:[Invalid team-role]]

I tried also the following which none worked as expected unfortunately since we're on the team plan and as the docs mention that it'll specify a minimum team role when role is not set:

I also tried importing the sentry_team_member.team_membership resource with role not set and apply even though there shouldn't be any changes, but it says it'll be updated in-place and get the same error.

marcaurele commented 7 months ago

I'm facing the same error while being on the Business plan. It makes impossible to import any team member into Terraform.