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

timeout while waiting for state to become 'success' (timeout: 2m0s) #760

Closed
pp185214 opened this issue Oct 25, 2023 · 2 comments · Fixed by #763
Closed

timeout while waiting for state to become 'success' (timeout: 2m0s) #760

pp185214 opened this issue Oct 25, 2023 · 2 comments · Fixed by #763

Comments

@pp185214
Copy link

Hi there,

We can see issue with plan for our services because it fail with error message:

│ Error: timeout while waiting for state to become 'success' (timeout: 2m0s)

│ with pagerduty_service.all_services["HSP Silver Pro Restaurant GOOGLE PLAY STORE"],
│ on services.tf line 31, in resource "pagerduty_service" "all_services":
│ 31: resource "pagerduty_service" "all_services" {

True is that we try to control 152 services in one loop and probably 2m0s timeout is not enough. It it possible to somehow increase this threshold please?

Thanks a lot.

Terraform Version

1.6.1

Affected Resource(s)

Please list the resources as a list, for example:

  • pagerduty_service
  • pagerduty_service_event_rule
  • pagerduty_service_integration

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

Terraform Configuration Files

locals {
    service_names = jsondecode(file("${path.module}/services.json"))
    all_services = [for service in local.service_names.services: service]
    # google_services = [for service in local.service_names.services: service if service == "HSP NCR Online Ordering NUA01 PROD" || service == "HSP Pulse Streaming (PST) CUG01 PROD" || service == "HSP Pulse Streaming (PST) CUG01 PREP"]
    # eventv2_services = [for service in local.service_names.services: service if service == "HSP Mobile Pay NUA01 PROD" || service == "HSP Pulse Streaming (PST) CUG01 PROD" || service == "HSP Pulse Streaming (PST) CUG01 PREP"]
}

resource "pagerduty_service" "all_services" {
  for_each                = toset(local.all_services)
  name                    = each.value
  description             = "This service is managed by Terraform from https://github.com/ncr-swt-hospitality/hsg-pagerduty-terraform"
  auto_resolve_timeout    = "null"
  acknowledgement_timeout = "null"
  escalation_policy       = "PWVKO9P"
  alert_creation          = "create_alerts_and_incidents"
  incident_urgency_rule {
    type    = "constant"
    urgency = "severity_based"
  }

}

/* 
  Service Event Rules for Azure Query alerts apiVersion 2021-08-01
*/

resource "pagerduty_service_event_rule" "query1-2021-08-01" {
  for_each = toset(local.all_services)
  service  = pagerduty_service.all_services[each.value].id
  position = 0
  disabled = false

    conditions {
        operator = "or"
        subconditions {
            operator = "matches"
            parameter {
                value = "[2-4]"
                path = "details.properties.severity"
            }
        }
    }
    variable {
        type = "regex"
        name = "name"
        parameters {
            path = "details.properties.displayName"
            value = "(.*)"
        }
    }
    actions {
        priority {
            value = "PVJ91KZ"
        }
        severity {
            value = "warning"
        }
        extractions {
            target = "summary"
            template = "{{name}}"
        }
    }

}

resource "pagerduty_service_event_rule" "query2-2021-08-01" {
  for_each = toset(local.all_services)
  service  = pagerduty_service.all_services[each.value].id
  position = 1
  disabled = false
    conditions {
        operator = "or"
        subconditions {
            operator = "matches"
            parameter {
                value = "[1]"
                path = "details.properties.severity"
            }
        }
    }
    variable {
        type = "regex"
        name = "name"
        parameters {
            path = "details.properties.displayName"
            value = "(.*)"
        }
    }
    actions {
        priority {
            value = "PGE641C"
        }
        severity {
            value = "error"
        }
        extractions {
            target = "summary"
            template = "{{name}}"
        }
    }

}

resource "pagerduty_service_event_rule" "query3-2021-08-01" {
  for_each = toset(local.all_services)
  service  = pagerduty_service.all_services[each.value].id
  position = 2
  disabled = false
    conditions {
        operator = "or"
        subconditions {
            operator = "matches"
            parameter {
                value = "[0]"
                path = "details.properties.severity"
            }
        }
    }
    variable {
        type = "regex"
        name = "name"
        parameters {
            path = "details.properties.displayName"
            value = "(.*)"
        }
    }
    actions {
        priority {
            value = "P53W568"
        }
        severity {
            value = "critical"
        }
        extractions {
            target = "summary"
            template = "{{name}}"
        }
    }

}

/* 
  Service Event Rules for Azure Metric alerts apiVersion 2018-03-01
*/

resource "pagerduty_service_event_rule" "metric1" {
  for_each = toset(local.all_services)
  service  = pagerduty_service.all_services[each.value].id
  position = 3
  disabled = false
    conditions {
        operator = "or"
        subconditions {
            operator = "matches"
            parameter {
                value = "[2-4]"
                path = "details.data.context.severity"
            }
        }
    }
    actions {
        priority {
            value = "PVJ91KZ"
        }
        severity {
            value = "warning"
        }
    }

}

resource "pagerduty_service_event_rule" "metric2" {
  for_each = toset(local.all_services)
  service  = pagerduty_service.all_services[each.value].id
  position = 4
  disabled = false
    conditions {
        operator = "or"
        subconditions {
            operator = "matches"
            parameter {
                value = "[1]"
                path = "details.data.context.severity"
            }
        }
    }
    actions {
        priority {
            value = "PGE641C"
        }
        severity {
            value = "error"
        }
    }

}

resource "pagerduty_service_event_rule" "metric3" {
  for_each = toset(local.all_services)
  service = pagerduty_service.all_services[each.value].id
  position = 5
  disabled = false
    conditions {
        operator = "or"
        subconditions {
            operator = "matches"
            parameter {
                value = "[0]"
                path = "details.data.context.severity"
            }
        }
    }
    actions {
        priority {
            value = "P53W568"
        }
        severity {
            value = "critical"
        }
    }

}

/* 
  Service Dependencies
*/


# resource "pagerduty_service_dependency" "example_application_database" {
#   dependency {
#     dependent_service {
#       id    = pagerduty_business_service.example_application.id
#       type  = "business_service"
#     }
#     supporting_service {
#       id    = pagerduty_service.example_application_database.id
#       type  = "service"
#     }
#   }
# }

/* 
  Technical Service Integrations (e.g. 3rd-party integration per technical service)
*/
resource "pagerduty_service_integration" "azure_integration" {
  for_each  = toset(local.all_services)
  name      = "Microsoft Azure"
  vendor    = data.pagerduty_vendor.azure.id
  service   = pagerduty_service.all_services[each.value].id

}

resource "pagerduty_service_integration" "google_integration" {
  for_each  = toset(local.all_services)
  name      = "Google Cloud"
  vendor    = data.pagerduty_vendor.google.id
  service   = pagerduty_service.all_services[each.key].id

}

resource "pagerduty_service_integration" "eventvapi2_integration" {
  for_each  = toset(local.all_services)
  name = "Events API v2"
  type = "events_api_v2_inbound_integration"
  service = pagerduty_service.all_services[each.key].id
  
}

/* 
  Technical Service Maintenance Window (e.g. disable creation of incidents during Christmas)
*/
# resource "pagerduty_maintenance_window" "christmas_downtime" {
#   start_time  = format("%s-12-24T17:00:00-00:00", formatdate("YYYY", timestamp()))
#   end_time    = format("%s-12-26T09:00:00-00:00", formatdate("YYYY", timestamp()))
#   services    = [
#                 pagerduty_service.example_application_website.id,
#                 pagerduty_service.example_application_database.id
#               ]

Debug Output

│ Error: timeout while waiting for state to become 'success' (timeout: 2m0s)

│ with pagerduty_service.all_services["HSP Silver Pro Restaurant GOOGLE PLAY STORE"],
│ on services.tf line 31, in resource "pagerduty_service" "all_services":
│ 31: resource "pagerduty_service" "all_services" {

Expected Behavior

It should do plan and apply

Actual Behavior

│ Error: timeout while waiting for state to become 'success' (timeout: 2m0s)

Steps to Reproduce

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

  1. terraform plan
  2. terraform apply
@YaffleZ
Copy link

YaffleZ commented Nov 3, 2023

After upgrading to 3.1.1 version of Pagerduty provider we are still having this issue.

@eitah
Copy link

eitah commented Nov 3, 2023

We are also still experiencing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants