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

Bug in sentry_integration_pagerduty resource when provisioning multiple resources in a plan #462

Open
dgeorges opened this issue Jun 28, 2024 · 1 comment

Comments

@dgeorges
Copy link

When provisioning multiple resources of type sentry_integration_pagerduty the terraform plan will fail with an error. Usual after the first resource has succeeded. The error is:

Service table item not found: ####

eg.
image

Looking at the code here it seems the sentry API is behaving as eventually consistent, instead of transactional because the code it does the following:

  1. Calls GET to the list the organization available integration for PD
  2. Calls Update to update the organization available integration for PD
  3. Calls GET to confirm that the update was successful. <- This throws the errors after inspecting the results

I should mention this only happens when there are multiple "sentry_integration_pagerduty" resources to provision. The first one succeeds and the following ones all fail.
When this happens the terraform state is left in a bad state and "terraform state rm" needs to be run to remove the last "sentry_integration_pagerduty" resource that didn't succeed.

It should fail gracefully without resulting in a bad statefile.

In the event the downstream api can not be changed. A retry or wait might help it not fail at all.

@jianyuan
Copy link
Owner

jianyuan commented Jun 28, 2024

Thanks for reporting this. It may be due to the endpoint only accepting a list of service table items, leading to a race condition when run concurrently. For example, the first process edits a table item while the second process also edits a table item. A fix is to ensure that the resource can run only once concurrently against the same integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants