provider/pagerduty: Allow timeouts to be disabled (pagerduty_service) (#11483)

* Vendor update

* Add exists check

* Update test

* Update documentation
This commit is contained in:
Alexander 2017-01-29 17:06:44 +01:00 committed by Paul Stack
parent b5e8d62b14
commit 5f94b51eb0
5 changed files with 18 additions and 15 deletions

View File

@ -117,6 +117,10 @@ func resourcePagerDutyServiceRead(d *schema.ResourceData, meta interface{}) erro
service, err := client.GetService(d.Id(), o)
if err != nil {
if isNotFound(err) {
d.SetId("")
return nil
}
return err
}

View File

@ -38,9 +38,9 @@ func TestAccPagerDutyService_Basic(t *testing.T) {
resource.TestCheckResourceAttr(
"pagerduty_service.foo", "description", "bar"),
resource.TestCheckResourceAttr(
"pagerduty_service.foo", "auto_resolve_timeout", "3600"),
"pagerduty_service.foo", "auto_resolve_timeout", "0"),
resource.TestCheckResourceAttr(
"pagerduty_service.foo", "acknowledgement_timeout", "3600"),
"pagerduty_service.foo", "acknowledgement_timeout", "0"),
),
},
},
@ -149,10 +149,8 @@ resource "pagerduty_escalation_policy" "foo" {
}
resource "pagerduty_service" "foo" {
name = "bar"
description = "bar"
auto_resolve_timeout = 3600
acknowledgement_timeout = 3600
escalation_policy = "${pagerduty_escalation_policy.foo.id}"
name = "bar"
description = "bar"
escalation_policy = "${pagerduty_escalation_policy.foo.id}"
}
`

View File

@ -2,8 +2,9 @@ package pagerduty
import (
"fmt"
"github.com/google/go-querystring/query"
"net/http"
"github.com/google/go-querystring/query"
)
// Integration is an endpoint (like Nagios, email, or an API call) that generates events, which are normalized and de-duplicated by PagerDuty to create incidents.
@ -59,8 +60,8 @@ type Service struct {
APIObject
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
AutoResolveTimeout *uint `json:"auto_resolve_timeout,omitempty"`
AcknowledgementTimeout *uint `json:"acknowledgement_timeout,omitempty"`
AutoResolveTimeout *uint `json:"auto_resolve_timeout"`
AcknowledgementTimeout *uint `json:"acknowledgement_timeout"`
CreateAt string `json:"created_at,omitempty"`
Status string `json:"status,omitempty"`
LastIncidentTimestamp string `json:"last_incident_timestamp,omitempty"`

6
vendor/vendor.json vendored
View File

@ -376,10 +376,10 @@
"revisionTime": "2016-11-03T18:56:17Z"
},
{
"checksumSHA1": "wzzdybMOEWsQ/crdkpTLneeob2U=",
"checksumSHA1": "trj+UY2oSzP0O1WJKz8auncslVs=",
"path": "github.com/PagerDuty/go-pagerduty",
"revision": "317bca1364fc322f4d6f8eeb276e931b6667b43b",
"revisionTime": "2016-12-20T22:05:08Z"
"revision": "fad777c9c72ec7c62aeec0194f01684d6a2efd0e",
"revisionTime": "2017-01-28T02:14:22Z"
},
{
"checksumSHA1": "ly9VLPE9GKo2U7mnbZyjb2LDQ3w=",

View File

@ -49,8 +49,8 @@ The following arguments are supported:
* `name` - (Required) The name of the service.
* `description` - (Optional) A human-friendly description of the escalation policy.
If not set, a placeholder of "Managed by Terraform" will be set.
* `auto_resolve_timeout` - (Optional) Time in seconds that an incident is automatically resolved if left open for that long.
* `acknowledgement_timeout` - (Optional) Time in seconds that an incident changes to the Triggered State after being Acknowledged.
* `auto_resolve_timeout` - (Optional) Time in seconds that an incident is automatically resolved if left open for that long. Disabled if not set.
* `acknowledgement_timeout` - (Optional) Time in seconds that an incident changes to the Triggered State after being Acknowledged. Disabled if not set.
* `escalation_policy` - (Required) The escalation policy used by this service.
## Attributes Reference