Commit Graph

34 Commits

Author SHA1 Message Date
Roman Laguta cb590e516d Added new evaluation_delay parameter (#14433)
* Added new evaluation_delay field

Added new evaluation_delay parameter to pass it through the datadog monitor api

* Changed tests for new evaluation_delay field

* changed documentation
2017-05-12 16:12:21 +03:00
Dan Thagard 0a37f35865 Allowed method on aggregator is `avg` ! `average` (#14414)
* Allowed method on aggregator is `avg` ! `average`

While Datadog will accept the value of `average` when creating the query graph, the resultant graph will be empty. Passing the value of `avg` instead correctly renders the graph.

* Fixed gofmt

* Updated test to match new aggregator method
2017-05-12 13:37:32 +03:00
Jesus Vazquez 3319b27123 Add last aggregator to datadog_timeboard resource (#14391)
* Add last aggregator to datadog_timeboard resource

* Fix go fmt
2017-05-11 15:23:22 +03:00
Radek Simko 8730bf125f datadog: Fix incorrect schema of monitor for 'silenced' (#12720) 2017-03-15 15:01:49 +00:00
Brian Flad 3e817e019f
provider/datadog: Add datadog_downtime resource (#10994)
* provider/datadog: Initial datadog_downtime resource

* provider/datadog: Update datadog_downtime resource to v2 library, fix recurrence handling

* provider/datadog: Fix datadog_downtime import test
2017-03-14 19:22:35 +02:00
Paul Stack b57e0bee2a provider/datadog: Update to datadog_monitor still used d.GetOk (#12497)
Fixes: #12494

The Create was changed to use the default and not d.GetOk - the update
wasn't - this was causing issues when trying to update to a false value

```
% make testacc TEST=./builtin/providers/datadog
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/07 16:20:54 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/datadog -v  -timeout 120m
=== RUN   TestDatadogMonitor_import
--- PASS: TestDatadogMonitor_import (4.77s)
=== RUN   TestDatadogUser_import
--- PASS: TestDatadogUser_import (6.23s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccDatadogMonitor_Basic
--- PASS: TestAccDatadogMonitor_Basic (3.83s)
=== RUN   TestAccDatadogMonitor_BasicNoTreshold
--- PASS: TestAccDatadogMonitor_BasicNoTreshold (4.92s)
=== RUN   TestAccDatadogMonitor_Updated
--- PASS: TestAccDatadogMonitor_Updated (5.88s)
=== RUN   TestAccDatadogMonitor_TrimWhitespace
--- PASS: TestAccDatadogMonitor_TrimWhitespace (3.23s)
=== RUN   TestAccDatadogMonitor_Basic_float_int
--- PASS: TestAccDatadogMonitor_Basic_float_int (5.73s)
=== RUN   TestAccDatadogTimeboard_update
--- PASS: TestAccDatadogTimeboard_update (8.86s)
=== RUN   TestValidateAggregatorMethod
--- PASS: TestValidateAggregatorMethod (0.00s)
=== RUN   TestAccDatadogUser_Updated
--- PASS: TestAccDatadogUser_Updated (6.05s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/datadog	49.506s
```
2017-03-07 16:36:37 +02:00
Brian Flad 4372592f0c
provider/datadog: Add datadog_user resource (#12268)
* provider/datadog: Add datadog_user resource

* provider/datadog: Fix datadog_user import test, simplify datadog_user ACC tests, more consise documentation
2017-02-27 10:38:54 +00:00
Paul Stack 8c9bfb7bfe provider/datadog: Adding default values to datadog_monitor (#12168)
Fixes: #8055
Fixes: #10264
Fixes: #10881

We have swapped from using d.GetOk (as that func returns nil when a
default value is used) and moved to using default values that we can
pass directly to the Struct. The fact we have default values, means that
we can use d.Get which will work here

```
% make testacc TEST=./builtin/providers/datadog
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/22 18:56:03 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/datadog -v  -timeout 120m
=== RUN   TestDatadogMonitor_import
--- PASS: TestDatadogMonitor_import (8.66s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccDatadogMonitor_Basic
--- PASS: TestAccDatadogMonitor_Basic (5.68s)
=== RUN   TestAccDatadogMonitor_BasicNoTreshold
--- PASS: TestAccDatadogMonitor_BasicNoTreshold (3.13s)
=== RUN   TestAccDatadogMonitor_Updated
--- PASS: TestAccDatadogMonitor_Updated (6.41s)
=== RUN   TestAccDatadogMonitor_TrimWhitespace
--- PASS: TestAccDatadogMonitor_TrimWhitespace (3.22s)
=== RUN   TestAccDatadogMonitor_Basic_float_int
--- PASS: TestAccDatadogMonitor_Basic_float_int (5.50s)
=== RUN   TestAccDatadogTimeboard_update
--- PASS: TestAccDatadogTimeboard_update (8.35s)
=== RUN   TestValidateAggregatorMethod
--- PASS: TestValidateAggregatorMethod (0.00s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/datadog	40.954s
```
2017-02-22 19:36:59 +02:00
Otto Jongerius 2310316666 provider/datadog: Upgrade to Datadog API v2 (#12098)
* provider/datadog: Pulls v2 and removes v1 of library go-datadog-api.

    See https://github.com/zorkian/go-datadog-api/issues/56 for context.

    * Fixes bug in backoff implementation that decreased performance significantly.
    * Uses pointers for field types, providing support of distinguishing
        between if a value is set, or the default value for that type is
        effective.

* provider/datadog: Convert provider to use v2 of go-datadog-api.

* provider/datadog: Update vendored library.

* provider/datadog: Update dashboard resource to reflect API updates.
2017-02-20 14:48:32 +02:00
Jesse Szwedko 5b7e3701cb [datadog] add support for new host delay to the datadog_monitor resource (#11975)
* [datadog] Update go-datadog-api library

Involves one breaking API change. Also some `gofmt`ing.

* [datadog] Add support for new_host_delay to the datadog_monitor resource

New API parameter that Datadog added for monitors to ignore new hosts
for the specified time period in monitor evaluation.
2017-02-17 17:08:31 +02:00
stack72 b6f67b2374
provider/datadog: Fix spelling mistake of monitor in datadog_monitor
error message

Fixes: #11951
2017-02-15 10:41:37 +00:00
Paul Stack a322e916ba provider/datadog: Default notify_no_data on datadog_monitor to false (#11903)
Fixes: #11863

Backwards incompatible so will not be pushed to 0.8.x series. This
follows the datadog documentation as mentioned in the issue

```
% make testacc TEST=./builtin/providers/datadog TESTARGS='-run=TestAccDatadogMonitor_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/13 12:30:24 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/datadog -v -run=TestAccDatadogMonitor_ -timeout 120m
=== RUN   TestAccDatadogMonitor_Basic
--- PASS: TestAccDatadogMonitor_Basic (84.23s)
=== RUN   TestAccDatadogMonitor_BasicNoTreshold
--- PASS: TestAccDatadogMonitor_BasicNoTreshold (81.92s)
=== RUN   TestAccDatadogMonitor_Updated
--- PASS: TestAccDatadogMonitor_Updated (82.91s)
=== RUN   TestAccDatadogMonitor_TrimWhitespace
--- PASS: TestAccDatadogMonitor_TrimWhitespace (63.34s)
=== RUN   TestAccDatadogMonitor_Basic_float_int
--- PASS: TestAccDatadogMonitor_Basic_float_int (75.84s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/datadog	388.257s
```
2017-02-13 14:31:00 +00:00
Jake Champlin f38e72f5fb
Fix fmt.Errorf() formatting 2017-01-13 18:19:35 -05:00
Jake Champlin 8fdc6518c8
provider/datadog: Add aggregator method to timeboard graph resource
Adds aggregator argument to the timeboard graph resource.

Ex:
```
request {
  q = "top(avg:docker.cpu.system{*} by {container_name}, 10, 'mean', 'desc')"
  aggregator = "sum"
}
```

```
$ make testacc TEST=./builtin/providers/datadog TESTARGS='-run=TestAccDatadogTimeboard_update'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/01/13 17:52:50 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/datadog -v -run=TestAccDatadogTimeboard_update -timeout 120m
=== RUN   TestAccDatadogTimeboard_update
--- PASS: TestAccDatadogTimeboard_update (82.60s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/datadog        82.619s
```

Fixes: #11168
2017-01-13 18:08:41 -05:00
Otto Jongerius 10d68d90dd provider/datadog 9869: Validate credentials when initialising client. (#10567)
* provider/datadog 9869: Validate credentials when initialising client.

* provider/datadog Pull in new version of go-datadog-api.

* provider/datadog Update testAccCheckDatadogMonitorConfigNoThresholds test config.
2016-12-08 11:17:42 +01:00
Otto Jongerius d06138d052 provider/datadog #9375: Refactor tags to a list instead of a map. (#10570)
* provider/datadog #9375: Refactor tags to a list instead of a map.
Tags are allowed to be but not restricted to, key value pairs (ie: foo:bar)
but are esssentially strings. This changes allows using, and mixing of tags with
form "foo" and "foo:bar". It also allows using duplicate keys like "foo:bar" and "foo:baz".

* provider/datadog update import test.
2016-12-07 12:05:57 +01:00
Brendan Shaklovitz 122e2f8170 provider/datadog: Improve datadog timeboard support (#10027)
* Update to latest version of go-datadog-api

* Updates to  latest go-datadog-api version, which adds more complete
timeboard support.

* Add more complete timeboard support

* Adds in support for missing timeboard fields, so now we can have nice
things like conditional formats and more.

* Document new fields in datadog_timeboard resource

* Add acceptance test for datadog timeboard changes
2016-12-05 13:16:47 +00:00
Otto Jongerius 5a4578edf6 provider/datadog #9026: Make thresholds optional. (#10526) 2016-12-05 09:52:59 +00:00
clint shryock 77075d0573 provider/datadog: Reduce diff on thresholds 2016-10-20 10:22:24 -05:00
Colin Saliceti cae5d8bbb9 Add type and styles to datadog timeboard graphs
Create the resources for title and styles and add them to the acceptance
test. Styles currently only support "palette".
2016-10-05 09:44:54 +01:00
Colin Saliceti b53d7a7b49 Use new Datadog GraphDefinitionRequest struct
This new struct avoids requiring to repeat the struct definition in this
code here. It avoids duplication and makes it more flexible so more
options can be added to the struct without breaking the code here.
2016-10-05 09:44:54 +01:00
Kurt Scherer a4fd7ce23b provider/datadog: Govendor update dependencies (#8428)
* Includes bugfixes in zorkian/go-datadog-api
* Struct changes upstream required small changes to provider code
2016-08-29 21:30:31 +01:00
Kurt Scherer faf43292c7 Add Import support for provider-datadog (#8324)
* Add import support
* Add import tests
* Fix tags/thresholds
* The type of the object is a float but the tests were using integers, so the
  tests were also adjusted to match.
* Fix Float formatting
* Provide thresholds as map[string]string to deal with formatting issues
* Adjust tests to deal with loss of trailing zeros on floats
2016-08-22 05:55:26 +02:00
Otto Jongerius 245e211b00 provider/datadog: Allow `tags` to be configured for monitor resources. (#8284) 2016-08-18 16:54:44 +01:00
Brian Edwards d79879dba4 provider/datadog: add timeboard resource. upgrade vendored go-datadog-api to support read-only option. (#6900) 2016-06-15 18:44:49 +02:00
Otto Jongerius 58e1c94335 provider/datadog Add test for no_data_timeframe. (#6765) 2016-05-19 14:51:27 +01:00
Otto Jongerius dc7a7219bf provider/datadog add 'require full window' and 'locked' (#6738)
* provider/datadog Update go-datadog-api.

* provider/datadog Add support for "require_full_window" and "locked".

* provider/datadog Update tests, update doco, gofmt.

* provider/datadog Add options to update resource.

* provider/datadog "require_full_window" defaults to True, "locked" to False. Use
those initial values as the starting configuration.

* provider/datadog Update notify_audit tests to use the default value for
testAccCheckDatadogMonitorConfig and a custom value for
testAccCheckDatadogMonitorConfigUpdated.

This catches a situation where the code ignores setting the option on creation,
and the update function merely asserts the default value, versus actually changing
the value.
2016-05-19 09:29:23 +01:00
David Glasser bef1b58fda provider/datadog: fix code to match schema
On Create, notify_no_data was being ignored.

On Read and Update, no_data_timeframe was being misused.

There was also a redundant read of escalation_message on Create.
2016-05-05 16:51:17 -07:00
James Nugent f2fef2556a Fix import formatting across code base 2016-04-18 17:28:46 -07:00
Matthew Brewer 4fcb90814f Make datadog message, escalation_message, and query work with heredoc 2016-03-22 15:18:17 -04:00
Otto Jongerius eb2407fccf provider/datadog: Replace separate monitors with one generic monitor with read functionality. 2016-02-22 15:04:11 -05:00
Kelvin Law 775a3f8826 provider/datadog: Add `query` parameter to `metric_alert`
`query` is used when it is specified by the user, if not
`metric`/`tags`/`keys`/`time_aggr`/`window` is used instead.
2016-02-22 15:03:51 -05:00
Otto Jongerius f407eea3f7 provider/datadog: Various enhancements
- Don't drop wildcard if it's the only one.
- Remove monitor resource, it's been replaced by metric_alert,
  outlier_alert and service_check
- Refactor to be closer to the API; each resource creates exactly *one*
  resource, not 2, this removes much unneeded complexity. A warning
  threshold is now supported by the API.
- Remove fuzzy resources like graph, and resources that used them for
  dashboard and screenboards. I'd welcome these resources, but the
  current state of Terraform and the Datadog API does not allow these to
  be implemented in a clean way.
- Support multiple thresholds for metric alerts, remove notify argument.
2016-02-22 15:02:50 -05:00
Vincenzo Prignano 1b84048aef provider/datadog: Initial commit 2016-02-22 15:02:35 -05:00