terraform-provider-pagerduty
terraform-provider-pagerduty copied to clipboard
Nil pointer dereference panic (during cancellation?) in v2.2.1
~~Disclaimer: this is an issue caused by another upstream issue. An upstream provider got a 503 from the service it talks to, which caused things to be canceled. Apparently 2.2.1 does not handle this cancellation gracefully.~~
Edited: apparently this is just an intermittent issue in this provider. Not always, but sometimes. It's now happened a second time w/o the other upstream provider breaking.
Since I cannot reproduce the 503 for you, the bug report is going to be a bit limited.
Terraform Version
1.0.11
Affected Resource(s)
Please list the resources as a list, for example:
- pagerduty_user
- pagerduty_schedule
- pagerduty_vendor
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
resource "pagerduty_user" "user" {
count = var.create_pagerduty_user ? 1 : 0
name = "${var.first_name} ${var.last_name}"
email = var.employee_email
role = var.pagerduty_role
lifecycle {
ignore_changes = [
job_title,
]
}
}
data "pagerduty_vendor" "datadog" {
name = "Datadog"
}
data "pagerduty_schedule" "sr_leadership_schedule" {
name = "Engineering Senior Leadership"
}
Debug Output
No debug input since I can't readily repro with it on due to the transient nature, but here's an excerpt. Each of these occurs many times (since we have many users), except for the one emitted by the provider that got a 503.
╷
│ Error: Request cancelled
│
│ with data.pagerduty_schedule.sr_leadership_schedule,
│ on global-pagerduty.tf line 1, in data "pagerduty_schedule" "sr_leadership_schedule":
│ 1: data "pagerduty_schedule" "sr_leadership_schedule" {
│
│ The plugin.(*GRPCProvider).ValidateDataResourceConfig request was
│ cancelled.
╵
╷
│ Error: client failed: client error 503:
│
│ with provider["registry.local/broken"],
│ on providers.tf line 148, in provider "broken":
│ 148: provider "broken" {
│
╵
╷
│ Error: Request cancelled
│
│ with module.architecture_group.data.pagerduty_vendor.datadog,
│ on modules/group/pagerduty.tf line 39, in data "pagerduty_vendor" "datadog":
│ 39: data "pagerduty_vendor" "datadog" {
│
│ The plugin.(*GRPCProvider).ValidateDataResourceConfig request was
│ cancelled.
╵
╷
│ Error: Request cancelled
│
│ with module.core_services_group.data.pagerduty_vendor.datadog,
│ on modules/group/pagerduty.tf line 39, in data "pagerduty_vendor" "datadog":
│ 39: data "pagerduty_vendor" "datadog" {
│
│ The plugin.(*GRPCProvider).ValidateDataResourceConfig request was
│ cancelled.
╵
│ Error: Plugin did not respond
│
│ with module.a_user.pagerduty_user.user[0],
│ on modules/user/pagerduty.tf line 1, in resource "pagerduty_user" "user":
│ 1: resource "pagerduty_user" "user" {
│
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
│ details.
╵
Panic Output
I can't actually get to crash.log since I'm running in github actions, but here's the panic trace:
Stack trace from the terraform-provider-pagerduty_v2.2.1 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0xf32e36]
goroutine 114 [running]:
github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.resourcePagerDutyUserRead.func1(0x2)
github.com/terraform-providers/terraform-provider-pagerduty/pagerduty/resource_pagerduty_user.go:157 +0x96
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.RetryContext.func1(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/resource/wait.go:27 +0x5b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.(*StateChangeConf).WaitForStateContext.func1(0xc0002e1b00, 0xc00029ed20, 0xc0001e6720, 0xc00066c700, 0xc000644590, 0xc000644588)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/resource/state.go:110 +0x2e9
created by github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.(*StateChangeConf).WaitForStateContext
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/resource/state.go:83 +0x1c6
Error: The terraform-provider-pagerduty_v2.2.1 plugin crashed!
Expected Behavior
What should have happened? No panic; cancel gracefully.
Actual Behavior
What actually happened? Panic.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
n/a
References
n/a
Seeing the same behavior with Terraform 1.1.3.
+1 same behavior.
I believe this is the same issue #447
+1 same behaviour.
This may now be addressed as part of #458 and released in version 2.3.0.