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

temperamental "Error: 0" in terraform plan caused by unhandled 502 from rollbar #318

Closed
dylan-shipwell opened this issue Sep 8, 2022 · 2 comments · Fixed by #321
Closed
Labels

Comments

@dylan-shipwell
Copy link

502 from rollbar, creates "Error 0"

[DEBUG] provider.terraform-provider-rollbar_v1.6.0: {
  "level": "error",
  "StatusCode": 502,
  "Status": "502 Bad Gateway",
  "ErrorResult": {
    "Err": 0,
    "Message": ""
  },
  "time": "2022-09-08T21:13:43Z"
}

$ terraform plan
│ Error: 0.
│.
│   with rollbar_project.main,
│   on terraform.tf line 17, in resource "rollbar_project" "main":
│   17: resource "rollbar_project" "main" {

relevant portions of TF_LOG=TRACE:

# ...
[DEBUG] provider.terraform-provider-rollbar_v1.6.0: {"level":"error","StatusCode":502,"Status":"502 Bad Gateway","ErrorResult":{"Err":0,"Message":""},"time":"2022-09-08T21:13:43Z"}
[DEBUG] provider.terraform-provider-rollbar_v1.6.0: {"level":"error","error":"0 ","time":"2022-09-08T21:13:43Z","message":"Error listing teams"}
[DEBUG] provider.terraform-provider-rollbar_v1.6.0: {"level":"error","error":"0 ","time":"2022-09-08T21:13:43Z","message":"Error listing custom teams"}
[DEBUG] provider.terraform-provider-rollbar_v1.6.0: {"level":"error","project_id":575948,"error":"0 ","time":"2022-09-08T21:13:43Z"}
[DEBUG] provider.terraform-provider-rollbar_v1.6.0: {"level":"error","projectID":575948,"error":"0 ","time":"2022-09-08T21:13:43Z"}
[TRACE] provider.terraform-provider-rollbar_v1.6.0: Called downstream: tf_proto_version=5 tf_provider_addr=provider tf_rpc=ReadResource @module=sdk.proto tf_req_id=62xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx99 tf_resource_type=rollbar_project @caller=github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:558 timestamp=2022-09-08T21:13:43.353Z
[TRACE] provider.terraform-provider-rollbar_v1.6.0: Served request: tf_req_id=62xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx99 tf_resource_type=rollbar_project tf_provider_addr=provider tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:564 @module=sdk.proto tf_proto_version=5 timestamp=2022-09-08T21:13:43.353Z
[ERROR] vertex "rollbar_project.main" error: 0 
[TRACE] vertex "rollbar_project.main": visit complete, with errors
[TRACE] vertex "rollbar_project.main": dynamic subgraph encountered errors: 0 
[ERROR] vertex "rollbar_project.main" error: 0 
[TRACE] vertex "rollbar_project.main": visit complete, with errors
[TRACE] vertex "rollbar_project.main (expand)": dynamic subgraph encountered errors: 0 
[ERROR] vertex "rollbar_project.main (expand)" error: 0 
[TRACE] vertex "rollbar_project.main (expand)": visit complete, with errors
[TRACE] dag/walk: upstream of "output.id (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "rollbar_project_access_token.notifications (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "rollbar_project_access_token.post_server_item (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "output.notifications_api_key (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/rollbar/rollbar\"].notifications_provider" errored, so skipping
[TRACE] dag/walk: upstream of "output.post_server_item_token (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "rollbar_notification.pd_resolve_item (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "rollbar_notification.pd_reactivate_item (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/rollbar/rollbar\"] (close)" errored, so skipping 
[TRACE] dag/walk: upstream of "rollbar_notification.pd_high_occurrence (expand)" errored, so skipping
[TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/rollbar/rollbar\"].notifications_provider (close)" errored, so skipping 
[TRACE] dag/walk: upstream of "(close)" errored, so skipping
# ...
╷
│ Error: 0.
│.
│   with rollbar_project.main,
│   on terraform.tf line 17, in resource "rollbar_project" "main":
│   17: resource "rollbar_project" "main" {
│.
╵

suggestions:

  • consider producing a descriptive diagnostic summary text,

    so relevant emitted DEBUG log lines and relevant terraform plan output produces meaningful messages.

  • consider implemented reasonable http request retry control for tempermental server errors,

    to reduce the impact of rollbar instability on Operators (especially those of us with way too many states in tf to refresh, where a failure to generate a state refresh is a major time sink)

troubleshooting

for what it's worth, I this symptom reproduced more reliably when TF_LOG=TRACE.
for what it's worth, adding TF_LOG=TRACE AND a null resource depends on (erroring vertex) reduced the reproducibility to similar levels as when TF_LOG was unset or set to DEBUG. Both of these observations are likely related to temporal rollbar api stability, not terraform quirks.

resource "null_resource" "tfbug_vertex_right" {
  depends_on = [rollbar_project.main]
}
@awendt
Copy link

awendt commented Sep 19, 2022

From what we've seen, the Resty client is not configured to retry:

// New Resty HTTP client
r := resty.New()
// Use default transport - needed for VCR
r.SetTransport(http.DefaultTransport)
// Authentication
if token != "" {
r = r.SetHeaders(map[string]string{
"X-Rollbar-Access-Token": token,
"X-Rollbar-Terraform": "true"})
} else {
log.Warn().Msg("Rollbar API token not set")
}
// Authentication
if baseURL == "" {
log.Error().Msg("Rollbar API base URL not set")
}
// Configure Resty to use Zerolog for logging
r.SetLogger(restyZeroLogger{log.Logger})
// Rollbar client
c := RollbarAPIClient{
Resty: r,
BaseURL: baseURL,
}

See also: https://github.com/go-resty/resty#retries

@github-actions
Copy link

🎉 This issue has been resolved in version 1.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants