github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/pagerduty/r/service.html.markdown (about) 1 --- 2 layout: "pagerduty" 3 page_title: "PagerDuty: pagerduty_service" 4 sidebar_current: "docs-pagerduty-resource-service" 5 description: |- 6 Creates and manages a service in PagerDuty. 7 --- 8 9 # pagerduty\_service 10 11 A [service](https://v2.developer.pagerduty.com/v2/page/api-reference#!/Services/get_services) represents something you monitor (like a web service, email service, or database service). It is a container for related incidents that associates them with escalation policies. 12 13 14 ## Example Usage 15 16 ``` 17 resource "pagerduty_user" "example" { 18 name = "Earline Greenholt" 19 email = "125.greenholt.earline@graham.name" 20 teams = ["${pagerduty_team.example.id}"] 21 } 22 23 resource "pagerduty_escalation_policy" "foo" { 24 name = "Engineering Escalation Policy" 25 num_loops = 2 26 27 rule { 28 escalation_delay_in_minutes = 10 29 30 target { 31 type = "user" 32 id = "${pagerduty_user.example.id}" 33 } 34 } 35 } 36 37 resource "pagerduty_service" "example" { 38 name = "My Web App" 39 auto_resolve_timeout = 14400 40 acknowledgement_timeout = 600 41 escalation_policy = "${pagerduty_escalation_policy.example.id}" 42 } 43 ``` 44 45 ## Argument Reference 46 47 The following arguments are supported: 48 49 * `name` - (Required) The name of the service. 50 * `description` - (Optional) A human-friendly description of the escalation policy. 51 If not set, a placeholder of "Managed by Terraform" will be set. 52 * `auto_resolve_timeout` - (Optional) Time in seconds that an incident is automatically resolved if left open for that long. Disabled if not set. 53 * `acknowledgement_timeout` - (Optional) Time in seconds that an incident changes to the Triggered State after being Acknowledged. Disabled if not set. 54 * `escalation_policy` - (Required) The escalation policy used by this service. 55 56 You may specify one optional `incident_urgency_rule` block configuring what urgencies to use. 57 Your PagerDuty account must have the `urgencies` ability to assign an incident urgency rule. 58 The block contains the following arguments. 59 60 * `type` - The type of incident urgency: `constant` or `use_support_hours` (when depending on specific suppor hours; see `support_hours`). 61 * `during_support_hours` - (Optional) Incidents' urgency during support hours. 62 * `outside_support_hours` - (Optional) Incidents' urgency outside of support hours. 63 64 When using `type = "use_support_hours"` in `incident_urgency_rule` you have to specify exactly one otherwise optional `support_hours` block. 65 Changes to `support_hours` necessitate re-creating the service resource. Account must have the `service_support_hours` ability to assign support hours. 66 The block contains the following arguments. 67 68 * `type` - The type of support hours. Can be `fixed_time_per_day`. 69 * `time_zone` - The time zone for the support hours. 70 * `days_of_week` - Array of days of week as integers. 71 * `start_time` - The support hours' starting time of day. 72 * `end_time` - The support hours' ending time of day. 73 74 When using `type = "use_support_hours"` in the `incident_urgency_rule` block you have to also specify `scheduled_actions` for the service. Otherwise `scheduled_actions` is optional. Changes necessitate re-createing the service resource. 75 76 * `type` - The type of scheduled action. Currently, this must be set to `urgency_change`. 77 * `at` - Represents when scheduled action will occur. 78 * `name` - Designates either the start or the end of the scheduled action. Can be `support_hours_start` or `support_hours_end`. 79 80 Below is an example for a `pagerduty_service` resource with `incident_urgency_rules` with `type = "use_support_hours"`, `support_hours` and a default `scheduled_action` as well. 81 82 ``` 83 resource "pagerduty_service" "foo" { 84 name = "bar" 85 description = "bar bar bar" 86 auto_resolve_timeout = 3600 87 acknowledgement_timeout = 3600 88 escalation_policy = "${pagerduty_escalation_policy.foo.id}" 89 90 incident_urgency_rule { 91 type = "use_support_hours" 92 93 during_support_hours { 94 type = "constant" 95 urgency = "high" 96 } 97 98 outside_support_hours { 99 type = "constant" 100 urgency = "low" 101 } 102 } 103 104 support_hours { 105 type = "fixed_time_per_day" 106 time_zone = "America/Lima" 107 start_time = "09:00:00" 108 end_time = "17:00:00" 109 days_of_week = [1, 2, 3, 4, 5] 110 } 111 112 scheduled_actions { 113 type = "urgency_change" 114 to_urgency = "high" 115 116 at { 117 type = "named_time" 118 name = "support_hours_start" 119 } 120 } 121 } 122 ``` 123 124 ## Attributes Reference 125 126 The following attributes are exported: 127 128 * `id` - The ID of the service. 129 130 ## Import 131 132 Services can be imported using the `id`, e.g. 133 134 ``` 135 $ terraform import pagerduty_service.main PLBP09X 136 ```