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

plugin crashes when importing incident workflows #809

Closed
mfmbarros opened this issue Jan 26, 2024 · 1 comment · Fixed by #820
Closed

plugin crashes when importing incident workflows #809

mfmbarros opened this issue Jan 26, 2024 · 1 comment · Fixed by #820

Comments

@mfmbarros
Copy link

Hi there,

Whenever I try to import an incident workflow, either via terraform cli or import blocks, a runtime error occurs in Pagerduty plugin.

Terraform Version

tested versions: 1.5.7 , 1.7.1

Affected Resource(s)

  • pagerduty_incident_workflow

Terraform Configuration Files

resource "pagerduty_incident_workflow" "my_slack_incident_workflow" {
  description = "Automatically name, create, and link Slack channels to the incident"
  name        = "Slack Channel"
  step {
    action = "pagerduty.com:incident-workflows:create-slack-channel:3"
    name   = "Create a Slack Channel for an Incident"

    input {
      name  = "Slack Team Name"
      value = var.slack_workspace_id
    }
    input {
      name  = "Desired Channel Name"
      value = "my-incident-{{incident.priority}}-{{incident.service.name}}-{{incident.incident_number}}"
    }
  }
}

import {
  to = pagerduty_incident_workflow.my_slack_incident_workflow
  id = "P5***KT"
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

https://gist.github.com/mfmbarros/2084baf4ad8ea37041ec996e5b323e74

Expected Behavior

Incident workflow imported with success.

Actual Behavior

Plugin crashes

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. create an incident workflow manually
  2. Import incident workflow with terraform plan or terraform import pagerduty_incident_workflow.my_slack_incident_workflow P5***KT
  3. Crash with panic output

References

@viktor-f3
Copy link

The same problem here. Trying to migrate from response plays to workflows and the docs are lacking on how to configure steps to use escalation policies, so trying to import and compare the results.

Stack trace from the terraform-provider-pagerduty_v3.7.0 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 63 [running]:
github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.flattenIncidentWorkflowSteps(0xc0001a04d0, {0x277da70, 0x0, 0x1bace00?})
	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty/resource_pagerduty_incident_workflow.go:491 +0x637
github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.flattenIncidentWorkflow(0xc000012368?, 0xc0001a04d0, 0x1, {0x277da70, 0x0, 0x0})
	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty/resource_pagerduty_incident_workflow.go:480 +0x118
github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.fetchIncidentWorkflow.func1()
	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty/resource_pagerduty_incident_workflow.go:456 +0x33f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.RetryContext.func1()
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/retry/wait.go:30 +0x56
github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.(*StateChangeConf).WaitForStateContext.func1()
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/retry/state.go:113 +0x1c4
created by github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.(*StateChangeConf).WaitForStateContext
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/retry/state.go:86 +0x1d8

Error: The terraform-provider-pagerduty_v3.7.0 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.

cjgajard added a commit to cjgajard/terraform-provider-pagerduty that referenced this issue Feb 16, 2024
cjgajard added a commit to cjgajard/terraform-provider-pagerduty that referenced this issue Feb 16, 2024
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

Successfully merging a pull request may close this issue.

2 participants