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

API errors lead to state file being wiped #40

Closed
taiidani opened this issue Sep 5, 2019 · 2 comments
Closed

API errors lead to state file being wiped #40

taiidani opened this issue Sep 5, 2019 · 2 comments

Comments

@taiidani
Copy link

taiidani commented Sep 5, 2019

On the master version of this provider (Terraform 0.12), I encountered behavior where some unknown event let to all Sentry resources disappearing from my tfstate file.

The going theory is that a problem with the Refresh/GET operation occurred on the Sentry side which instead of causing a failure caused this provider to return empty objects, leading to a success status and an empty payload.

I've seen similar behavior before when a Sentry API key is provided that doesn't have sufficient access to GET the resources from the API. Instead of erring out it succeeds and declares the resource to be non-existent, when in fact it does exist and the Provider doesn't have access to see it.

@taiidani taiidani changed the title State File Wiped API errors lead to state file being wiped Sep 5, 2019
@remilapeyre
Copy link

I have this issue, importing them back works as a workaround but it would be better in the provider could only remove them if it got an actual response from the API.

jianyuan pushed a commit that referenced this issue Jun 3, 2020
This new helper properly and uniformly handles Sentry API 404 errors
with respect to the Terraform SDK. Prior to this commit, in most places
an API error was always interpretted as a missing resource. Now, a 404
is considered a missing resource and other API errors are surfaced as
real errors. This will ensure that, for example, a user with a malformed
API token (bad permissions, etc) doesn't wipe out Terraform state.

Fixes the following Github issues:

- #40
- #57
@jianyuan
Copy link
Owner

jianyuan commented Jun 3, 2020

Fixed in #70.

@jianyuan jianyuan closed this as completed Jun 3, 2020
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

3 participants