PagerDuty / terraform-provider-pagerduty

Terraform PagerDuty provider
https://www.terraform.io/docs/providers/pagerduty/
Mozilla Public License 2.0
204 stars 212 forks source link

The provider doesn't seem to be handling GetTagWithContext properly #940

Open themarcelor opened 1 month ago

themarcelor commented 1 month ago

Hi,

We've been experiencing an error consistently Error calling GetTagWithContext while trying to run terraform plan to provision some PagerDuty resources and apply TAGS to them. I suspect this might be related to a change in the PagerDuty API:

curl -s -H 'Content-Type: application/json' -H "Authorization: Token token=${API_TOKEN}" -X GET "https://api.pagerduty.com/tags/PJMK666" | jq .
"Object not found"

And how the provider tries to unmarshal that into a pagerduty.Tag struct instance.

Terraform Version

Terraform v1.6.2

Affected Resource(s)

Terraform Configuration Files

resource "pagerduty_tag" "composite_name_tag" {
  label = replace(lower(var.composite_name), " ", "-")
}

Debug Output

│ Error: Error calling GetTagWithContext
│ 
│ Could not decode JSON response: json: cannot unmarshal number into Go value
│ of type pagerduty.Tag

Expected Behavior

The GetTagWithContext response was supposed to be unmarshaled successful and the tag was supposed to be used by a pagerduty_tag_assignment resource without problems.

Actual Behavior

I think the provider is failing while trying to determine if the tag already exists so it can update it. But it just throws this error: Error calling GetTagWithContext.

Steps to Reproduce

  1. terraform plan