Skip to content

Error: 400 Bad Request. Code: 2001 - timeout cannot be null for PUT API call when applying pagerduty_service resource #1015

@kandula-chakradhar

Description

@kandula-chakradhar

Terraform Version:

v1.1.9

Provider Version:

v3.25.0

Description:

I am encountering an error when trying to apply a Terraform configuration for the pagerduty_service resource. The error message returned is:

Error: Error reading: <our-internal-service-id>: PUT API call to https://api.pagerduty.com/services/<our-internal-service-id> failed 400 Bad Request. Code: 2001, Errors: [timeout cannot be null], Message: Invalid Input Provided

Terraform Configuration:

Here’s the current configuration for the pagerduty_service resource:

resource "pagerduty_service" "default" {
  count = local.global_shard ? 1 : 0

  name                    = local.service_name
  description             = local.service_description
  escalation_policy       = var.escalation_policy 
  acknowledgement_timeout = var.service_acknowledgement_timeout
  alert_creation          = var.service_alert_creation
  auto_resolve_timeout    = var.service_auto_resolve_timeout

  lifecycle {
    ignore_changes = [
      response_play
    ]
  }

  dynamic "incident_urgency_rule" {
    for_each = var.service_support_hours != null ? [1] : []

    content {
      type = "use_support_hours"

      during_support_hours {
        type    = "constant"
        urgency = "high"
      }

      outside_support_hours {
        type    = "constant"
        urgency = "low"
      }
    }
  }

  dynamic "scheduled_actions" {
    for_each = var.service_support_hours != null ? [1] : []

    content {
      type       = "urgency_change"
      to_urgency = "high"

      at {
        type = "named_time"
        name = "support_hours_start"
      }
    }
  }

  dynamic "support_hours" {
    for_each = var.service_support_hours != null ? [1] : []

    content {
      type         = var.service_support_hours.type
      time_zone    = var.service_support_hours.time_zone
      start_time   = var.service_support_hours.start_time
      end_time     = var.service_support_hours.end_time
      days_of_week = var.service_support_hours.days_of_week
    }
  }
}

Configuration:

The acknowledgement_timeout and auto_resolve_timeout values are defined as strings in my variables.tf file with default values:

variable "service_acknowledgement_timeout" {
  type        = string
  description = "The acknowledgement timeout of the PagerDuty service."
  default     = "1800"
}

variable "service_auto_resolve_timeout" {
  type        = string
  description = "The auto resolve timeout of the PagerDuty service."
  default     = "14400"
}

Terraform Plan Output:

Here is what we see in the terraform plan output:

# module.pagerduty_service[0].pagerduty_service.default[0] will be updated in-place
  ~ resource "pagerduty_service" "default" {
      ~ description             = <<-EOT
            Managed by Terraform
          - Repository: Internal-repository
          + Repository: Another-Internal-repository
        EOT
        id                      = "Internal-Service-Id"
        name                    = "Our Internal Service Name"
        # (11 unchanged attributes hidden)


        # (2 unchanged blocks hidden)
    }

Additional Information:

We haven't made any change to our tf module, so suspecting that issue is with the latest pagerduty provider

Suggestions:

Please advise on next steps that we need to do to fix the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions