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

The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. #447

Open
katkasian opened this issue Jan 17, 2022 · 4 comments

Comments

@katkasian
Copy link
Contributor

Terraform Version

Terraform v1.1.3
on darwin_amd64

  • provider registry.terraform.io/pagerduty/pagerduty v2.2.1

Affected Resource(s)

Please list the resources as a list, for example:

  • pagerduty_ruleset_rule

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

https://drive.google.com/file/d/1xuDkQClruBJlSMxwf-dFCj86jHj1fGXW/view?usp=sharing

Debug Output

https://gist.github.com/katkasian/c031f41ac5fa0ea6ad9729f591171863

Panic Output

NA

Expected Behavior

When creating a module to create rulesets, I expect the apply to be successful.

Actual Behavior

Encountering "The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details." error, provider crashes. On PagerDuty side, ruleset gets created, but not individual rules.

Steps to Reproduce

  1. Download the configuration files
  2. Initiate a terraform repo in the Archive folder.
  3. Create / copy PagerDuty API key
  4. Run terraform apply, provide the key when prompted.

Important Factoids

Rulesets are managed using a module (contained in ruleset folder of the zip file)

@NargiT
Copy link
Contributor

NargiT commented Jan 17, 2022

I have also some issues with this version. on multiple resources, it's hard to understand what is going on.
And i cannot revert de provider because I always get "a number is required" on the old provider (v1)

│ Error: Request cancelled
│ 
│   with pagerduty_service.xxxxx,
│   on auto-service-xxxxx.tf line 4, in resource "pagerduty_service" "xxxxx":
│    4: resource "pagerduty_service" "xxxxx" {
│ 
│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.
╵

Stack trace from the terraform-provider-pagerduty_v2.1.1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0xf27f34]

goroutine 463 [running]:
github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.resourcePagerDutyServiceRead.func1(0x2)
	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty/resource_pagerduty_service.go:379 +0x94
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.RetryContext.func1(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/resource/wait.go:27 +0x5b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.(*StateChangeConf).WaitForStateContext.func1(0xc0007b6fc0, 0xc0007e2d20, 0xc00047ca80, 0xc000424e80, 0xc0001a4d30, 0xc0001a4d28)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/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/v2@v2.7.1/helper/resource/state.go:83 +0x1c6

Error: The terraform-provider-pagerduty_v2.1.1 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
│ Error: Request cancelled
│ 
│   with pagerduty_ruleset_rule.yyyyy,
│   on auto-service-yyyyy.tf line 28, in resource "pagerduty_ruleset_rule" "yyyyy":
│   28: resource "pagerduty_ruleset_rule" "yyyyy" {
│ 
│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.
╵

Stack trace from the terraform-provider-pagerduty_v2.1.1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0xf26095]

goroutine 26139 [running]:
github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.resourcePagerDutyRulesetRuleRead.func1(0x2)
	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty/resource_pagerduty_ruleset_rule.go:767 +0x95
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.RetryContext.func1(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/helper/resource/wait.go:27 +0x5b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.(*StateChangeConf).WaitForStateContext.func1(0xc000c9ba40, 0xc000725ab0, 0xc00033b1a0, 0xc000478d80, 0xc0005c14a8, 0xc0005c14a0)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.1/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/v2@v2.7.1/helper/resource/state.go:83 +0x1c6

Error: The terraform-provider-pagerduty_v2.1.1 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

@NargiT
Copy link
Contributor

NargiT commented Jan 18, 2022

This is really random, I have 5000 resources to manage and sometimes it works sometimes it fails. I also tried to run it with -parallelism=1 and still get the same error at some point.

@PitcherIT
Copy link

In the original examples @gsreynolds identified the issue being that the provider was crashing because it does not expect null to be passed as a value. Where there is no priority, route, severity or annotation (in the case of the event rule) the provider expects the block to be omitted. Also when setting the priority, you need to provide the priority ID and not the name/summary. HTH

@gsreynolds
Copy link
Member

Specifically, the priority, route, severity, or annotation blocks would need to be omitted in a similar manner using dynamic blocks as the linked example Terraform did for extractions and suppress.

On the Priority ID lookup, the following would look up the specified priorities:

locals {
  pagerduty_priorities = toset(["P1", "P2", "P3", "P4", "P5"])
}

data "pagerduty_priority" "priorities" {
  for_each = local.pagerduty_priorities
  name = each.key
}

and thus a priority ID can then be looked up with

data.pagerduty_priority.priorities["P1"].id

or in the example code

data.pagerduty_priority.priorities[actions.value.priority].id

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

4 participants