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

Wants to create resource when token has no permission to view #57

Closed
charlesverdad opened this issue Mar 5, 2020 · 2 comments
Closed

Comments

@charlesverdad
Copy link

I have a *.tf file with a sentry_team resource.

After creating the team using terraform, If I use a SENTRY_TOKEN with no permission to read teams, then the provider assumes the team doesn't exist and wants to create a new one.

Took me a while to figure out that the problem was a permissions scope thing. I'd expected the provider to output something like a 403 error instead of silently failing.

@mwarkentin
Copy link
Contributor

Just a hunch, but this might be an issue with the way the sentry api responds if you don't have permission to view an object (a team in this case) - often APIs will return a 404 instead of a 403 error if you're missing permissions so that it doesn't expose if a team exists or not to anyone who tries to check. It does probably make it tricky to handle nicely in the terraform provider (the github provider has similar issues if your token isn't configured correctly).

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