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

Provider dont catch permissions error and delete resource from state. #930

Open
MariaSu opened this issue Aug 23, 2022 · 0 comments
Open

Comments

@MariaSu
Copy link

MariaSu commented Aug 23, 2022

Description

Provider dont catch permissions error and delete resource from state.

Go Version

1.18.3

Current behavior

Drop rule on recreate/delete not deleted in newrelic, but terraform success finish. On recreate this create new additional rule

Expected behavior

delete drop rule in newrelic on recreate/delete and catch permission error
here code catch only http error but not USER_NOT_AUTHORIZED

_, err = c.Do(req)
if err != nil {
return err
}

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create API key with delete drop rule permission
  2. Create drop rule with terraform
  3. delete drop rule with terraform
  4. terraform finish but rule still working

Additional Context

curl return

< HTTP/1.1 200 OK
< Proxied-By: Service Gateway
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Content-Security-Policy: frame-ancestors *.newrelic.com
< Cache-Control: max-age=0, private, must-revalidate
< Content-Length: 196
< Content-Type: application/json; charset=utf-8
< Date: Tue, 23 Aug 2022 21:59:37 GMT
< Served-By: nerd-graph
< Server: Cowboy
<
* Connection #0 to host api.newrelic.com left intact
{"data":{"nrqlDropRulesDelete":{"failures":[{"error":{"description":"user is not authorized","reason":"USER_NOT_AUTHORIZED"},"submitted":{"accountId":XXXX,"ruleId":"XXXXX"}}],"successes":[]}}}%

so it's code 200, but error from server, provider don't catch this.

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

1 participant