rollbar / terraform-provider-rollbar

Terraform provider for Rollbar
https://rollbar.com
MIT License
28 stars 13 forks source link

resource_user refresh performance improvement #362

Closed JJaakson closed 1 year ago

JJaakson commented 1 year ago

Our Infrastructure has over a 1500 user resources, and we want to start using Terraform to manage these, but because we also have a lot of teams it is taking a lot of time to refresh the resources when running terraform plan/apply. Whenever user resource refresh is initiated it starts searching for all "teams" it is part of, but since there isn't a direct api call to query all "invitations" for this users email, it starts going through all team in our organisation and for us it takes ~1 min per user. So based on this calculated it would take us over 1500 minutes, which is too long.

This is the function where all teams are being checked to find the invitations for one user: https://github.com/rollbar/terraform-provider-rollbar/blob/be38bdcbb44f814454559d5340d58c9cdda106d7/client/invitation.go#L238

Would be nice if there was an API endpoint that was used to get all invitations for an email, then only one request is needed to be called out, instead of 180+ requests (for our organisation). Based on what the current API endpoint returns it should be possible to implement a search/query by passing along an email.

Similar improvement (https://github.com/rollbar/terraform-provider-rollbar/pull/357) was done for projects with the provider-version update to 1.12.0. (Projects teams are now queryable by ProjectID instead of going through all teams projects to find the teams one project is part of). And this really helped us, making our 1500+ project resources refreshed in 18 minutes.

ghost commented 1 year ago

Hey @JJaakson, We're working on this fix. I'll update you when it's ready.

ghost commented 1 year ago

Hey @JJaakson, We released the performance improvement recently. I'll close this ticket. Let me know if you need further assistance.