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

[BUG] Recreate Workflow & Workflow Trigger fails #948

Closed
CristhianMotoche opened this issue Nov 5, 2024 · 1 comment
Closed

[BUG] Recreate Workflow & Workflow Trigger fails #948

CristhianMotoche opened this issue Nov 5, 2024 · 1 comment

Comments

@CristhianMotoche
Copy link

Terraform Version

1.9.8 in Terraform Cloud

Affected Resource(s)

  • pagerduty_incident_workflow_trigger
  • pagerduty_incident_workflow

Terraform Configuration Files

data "pagerduty_team" "pd_team" {
  name = "SomeTeam"
}

resource "pagerduty_incident_workflow" "workflow" {
  name        = "Workflow [${upper(var.environment)}]"
  description = "Desc"
  team        = data.pagerduty_team.pd_team.id

  step {
    name   = "POST to API"
    action = "pagerduty.com:http-api:send-post-request:3"

    input {
      name  = "Request URL"
      value = "https://some.api.com/"
    }
    input {
      name  = "Authentication Headers"
      value = "foo-bar-baz"
    }
    input {
      name  = "Headers"
      value = "Content-Type: application/json"
    }
    input {
      name  = "Body"
      value = <<EOF
{ "some": "json" }
EOF
    }
  }
}

data "pagerduty_service" "pd_service" {
  name = "Some service"
}

resource "pagerduty_incident_workflow_trigger" "workflow_trigger" {
  type                       = "conditional"
  workflow                   = pagerduty_incident_workflow.workflow.id
  services                   = [data.pagerduty_service.pd_service.id]
  condition                  = "incident.urgency matches 'high'"
  subscribed_to_all_services = false
}

Debug Output

https://gist.github.com/CristhianMotoche/84bfaf154f2c711fff311ec4731c7aaa

Panic Output

N/A

Expected Behavior

It will recreate the workflow trigger from scratch again.

Actual Behavior

It fails with the error:

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

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

goroutine 85 [running]:
github.com/PagerDuty/terraform-provider-pagerduty/pagerduty.flattenIncidentWorkflowTrigger(0xc000012398?, 0xc0004374a0)
github.com/PagerDuty/terraform-provider-pagerduty/pagerduty/resource_pagerduty_incident_workflow_trigger.go:212 +0x85
github.com/PagerDuty/terraform-provider-pagerduty/pagerduty.fetchIncidentWorkflowTrigger.func1()
github.com/PagerDuty/terraform-provider-pagerduty/pagerduty/resource_pagerduty_incident_workflow_trigger.go:202 +0x25b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.RetryContext.func1()
...

Steps to Reproduce

  1. terraform apply

Important Factoids

The workflow was created fine at first. I removed it manually to recreate it from scratch and then preparing the plan failed with the above error.

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

@CristhianMotoche
Copy link
Author

Fortunately, I managed to fix it by removing the references to pagerduty provider from the TFC state as mentioned in this post: https://support.hashicorp.com/hc/en-us/articles/30435545564307-Invalid-provider-configuration-and-unsupported-attribute-override-json

I'll close this issue for now.

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