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

Merge upstream #3

Merged
merged 55 commits into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0bcf856
Downtime improvements
platinummonkey May 15, 2019
27f41b1
fix "resource datadog_downtime: monitor_tags: ValidateFunc is not yet…
platinummonkey May 15, 2019
e675fca
Add default of 10m for monitor no data timeframe
nmuesch May 20, 2019
66a58d3
Add link to documentation aobut monitor types
nmuesch May 20, 2019
12051c8
fixes https://github.com/terraform-providers/terraform-provider-datad…
platinummonkey May 21, 2019
4fe5e14
Update wording based on review
nmuesch May 21, 2019
e518027
Merge pull request #213 from nmuesch/nick/network
May 21, 2019
90631c3
Merge pull request #214 from platinummonkey/monitor-tags-are-not-sorted
nmuesch May 23, 2019
f0361a5
Merge pull request #212 from nmuesch/nick/no_data
nmuesch May 23, 2019
7e3bec6
Allow adding metadata aliases for widgets in screenboards and timeboa…
May 20, 2019
a783e02
Merge branch 'boards-support-metadata-alias' of https://github.com/bk…
nmuesch May 23, 2019
23654f3
Allow adding metadata aliases for widgets in screenboards and timeboa…
May 20, 2019
e542bfa
Merge pull request #215 from bkabrda/boards-support-metadata-alias
May 23, 2019
1a7360e
Upgrade terraform to 0.12.
jmcarp May 24, 2019
e636249
Add examples header
nmuesch May 24, 2019
9c11f4c
Address merge conflicts
nmuesch May 24, 2019
90afa85
Merge branch 'master' into nick/add_examples
nmuesch May 24, 2019
df10f46
Add disclaimer
nmuesch May 28, 2019
e29d193
update docs
platinummonkey Jun 3, 2019
9052db2
Merge pull request #204 from platinummonkey/downtime-improvements
nmuesch Jun 3, 2019
00b7440
Merge pull request #220 from nmuesch/nick/add_examples
nmuesch Jun 3, 2019
c919ea1
Merge pull request #219 from jmcarp/terraform-0.12
Jun 4, 2019
2704091
Revert "#148 Fix log monitor UI issue: generate queryConfig.queryStri…
Jun 5, 2019
8dae8b4
Merge pull request #226 from bkabrda/revert-query-config
Jun 5, 2019
aae182b
Support Synthetics tests in composite monitors (#222)
gabsn Jun 6, 2019
60559be
go mod tidy
radeksimko Jun 6, 2019
eb3fb1f
Merge pull request #227 from terraform-providers/go-mod-tidy
Jun 6, 2019
cd08f68
Suppress diff on default silence
nmuesch Jun 7, 2019
55d95e4
Merge pull request #228 from nmuesch/nick/suppress_silence
nmuesch Jun 7, 2019
834f3ad
Update to go-datadog-api v2.21.0, run
Jun 10, 2019
512e302
Add proper validation and docs for timeboard graphs extra_col attribute
Jun 11, 2019
c8bc95f
Merge pull request #230 from bkabrda/apiclient-v2.21.0
Jun 11, 2019
714af31
Add example on constructing dynamic timeboards. Fixes #47, #64.
Jun 11, 2019
a9db594
Merge pull request #232 from bkabrda/dynamic-timeboards
Jun 11, 2019
83cf602
Merge pull request #231 from bkabrda/timeboard-extra-col-fix
Jun 11, 2019
7f4b503
Deprecate Silence attribute and Fix multiple terraform runs (#221)
nmuesch Jun 11, 2019
6552bce
Fix several integration tests and related code
Jun 12, 2019
ace799f
Merge pull request #234 from bkabrda/fix-acc-tests-again
Jun 13, 2019
19e2ae8
Mention units explicitly (#233)
pratikmallya Jun 13, 2019
0c2e0ac
Mark datadog_monitor.type as ForceNew, since changing type is not act…
Jun 14, 2019
c9de71e
Merge pull request #236 from bkabrda/monitor-type-forcenew
Jun 14, 2019
5051c71
Add an examply of an anomaly monitor (#239)
nmuesch Jun 17, 2019
3b5b0af
Fix up the GCP and User tests (#238)
nmuesch Jun 17, 2019
63d5e97
Update changelog (#240)
nmuesch Jun 18, 2019
d8b5f66
v2.0.0
Jun 18, 2019
41ebcc0
Cleanup after v2.0.0 release
Jun 18, 2019
f011a8b
`datadog_monitor` ignore `query alert` vs `metric alert` diff (#242)
nmuesch Jun 20, 2019
fa2adef
Clarify the logic around monitors changing types by adding parenthese…
Jun 20, 2019
c21a624
Update changelog (#243)
nmuesch Jun 20, 2019
3ad28c0
v2.0.1
Jun 21, 2019
4375e8a
Cleanup after v2.0.1 release
Jun 21, 2019
d9fb4bc
Use suppressdiff on monitor type (#247)
nmuesch Jun 26, 2019
56a49bb
Prep 2.0.2 release (#248)
nmuesch Jun 26, 2019
b542d3d
v2.0.2
Jun 26, 2019
31e2989
Cleanup after v2.0.2 release
Jun 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
## 1.10.0 (Unreleased)
## 2.1.0 (Unreleased)
## 2.0.2 (June 26, 2019)

BUGFIXES:
* `datadog_monitor`: DiffSuppress the difference between `metric alert` and `query alert` no matter what is in the current state and prevent the force recreation of monitors due to this change. ([#247](https://github.com/terraform-providers/terraform-provider-datadog/issues/247))

## 2.0.1 (June 21, 2019)

BUGFIXES:
* `datadog_monitor`: Don't force the destruction and recreation of a monitor when the type changes between `metric alert` and `query alert`. ([#242](https://github.com/terraform-providers/terraform-provider-datadog/issues/242))

## 2.0.0 (June 18, 2019)

NOTES:
* `datadog_monitor`: The silence attribute is beginning its deprecation process, please use `datadog_downtime` instead ([#221](https://github.com/terraform-providers/terraform-provider-datadog/issues/221))

IMPROVEMENTS:
* `datadog_monitor`: Use ForceNew when changing the Monitor type ([#236](https://github.com/terraform-providers/terraform-provider-datadog/issues/236))
* `datadog_monitor`: Add default to `no data` timeframe of 10 minutes. ([#212](https://github.com/terraform-providers/terraform-provider-datadog/issues/212))
* `datadog_synthetics_test`: Support synthetics monitors in composite monitors. ([#222](https://github.com/terraform-providers/terraform-provider-datadog/issues/222))
* `datadog_downtime`: Add validation to tags, add timezone parameter, improve downtime id handling, add descriptions to fields. ([#204](https://github.com/terraform-providers/terraform-provider-datadog/issues/204))
* `datadog_screenboard`: Add support for metadata alias in graphs. ([#215](https://github.com/terraform-providers/terraform-provider-datadog/issues/215))
* `datadog_screenboard`: Add `custom_bg_color` to graph config. [[#189](https://github.com/terraform-providers/terraform-provider-datadog/issues/189)] Thanks [@milanvdm](https://github.com/milanvdm)
* Update the vendored go client to `v2.21.0`. ([#230](https://github.com/terraform-providers/terraform-provider-datadog/issues/230))

BUGFIXES:
* `datadog_timeboard`: Fix the `extra_col` from having a non empty plan when there are no changes. ([#231](https://github.com/terraform-providers/terraform-provider-datadog/issues/231))
* `datadog_timeboard`: Fix the `precision` from having a non empty plan when there are no changes. ([#228](https://github.com/terraform-providers/terraform-provider-datadog/issues/228))
* `datadog_monitor`: Fix the sorting of monitor tags that could lead to a non empty diff. ([#214](https://github.com/terraform-providers/terraform-provider-datadog/issues/214))
* `datadog_monitor`: Properly save `query_config` as to avoid to an improper non empty diff. ([#209](https://github.com/terraform-providers/terraform-provider-datadog/issues/209))
* `datadog_monitor`: Fix and clarify documentation on unmuting monitor scopes. ([#202](https://github.com/terraform-providers/terraform-provider-datadog/issues/202))
* `datadog_screenboard`: Change monitor schema to be of type String instead of Int. [[#154](https://github.com/terraform-providers/terraform-provider-datadog/issues/154)] Thanks [@mnaboka](https://github.com/mnaboka)

## 1.9.0 (May 09, 2019)

IMPROVEMENTS:
Expand Down
1 change: 1 addition & 0 deletions datadog/import_datadog_downtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ resource "datadog_downtime" "foo" {
scope = ["host:X", "host:Y"]
start = 1735707600
end = 1735765200
timezone = "UTC"

message = "Example Datadog downtime message."
monitor_tags = ["*"]
Expand Down
77 changes: 62 additions & 15 deletions datadog/resource_datadog_downtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ func resourceDatadogDowntime() *schema.Resource {
_, recurrencePresent := d.GetOk("recurrence")
return recurrencePresent
},
Description: "When true indicates this downtime is being actively applied",
},
"disabled": {
Type: schema.TypeBool,
Optional: true,
Type: schema.TypeBool,
Optional: true,
Description: "When true indicates this downtime is not being applied",
},
"start": {
Type: schema.TypeInt,
Expand All @@ -43,6 +45,7 @@ func resourceDatadogDowntime() *schema.Resource {
_, startDatePresent := d.GetOk("start_date")
return startDatePresent
},
Description: "Specify when this downtime should start",
},
"start_date": {
Type: schema.TypeString,
Expand All @@ -57,24 +60,34 @@ func resourceDatadogDowntime() *schema.Resource {
_, endDatePresent := d.GetOk("end_date")
return endDatePresent
},
Description: "Optionally specify an end date when this downtime should expire",
},
"end_date": {
Type: schema.TypeString,
ValidateFunc: validation.ValidateRFC3339TimeString,
ConflictsWith: []string{"end"},
Optional: true,
},
"timezone": {
Type: schema.TypeString,
Default: "UTC",
Optional: true,
Description: "The timezone for the downtime, default UTC",
ValidateFunc: validateDatadogDowntimeTimezone,
},
"message": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "An optional message to provide when creating the downtime, can include notification handles",
StateFunc: func(val interface{}) string {
return strings.TrimSpace(val.(string))
},
},
"recurrence": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Optional recurring schedule for this downtime",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"period": {
Expand Down Expand Up @@ -108,18 +121,23 @@ func resourceDatadogDowntime() *schema.Resource {
},
},
"scope": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "specify the group scope to which this downtime applies. For everything use '*'",
},
"monitor_id": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
ConflictsWith: []string{"monitor_tags"},
Description: "When specified, this downtime will only apply to this monitor",
},
"monitor_tags": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeList,
Optional: true,
Description: "A list of monitor tags (up to 25), i.e. tags that are applied directly to monitors to which the downtime applies",
ConflictsWith: []string{"monitor_id"},
Elem: &schema.Schema{Type: schema.TypeString},
},
},
}
Expand Down Expand Up @@ -190,6 +208,9 @@ func buildDowntimeStruct(d *schema.ResourceData) *datadog.Downtime {
} else if attr, ok := d.GetOk("start"); ok {
dt.SetStart(attr.(int))
}
if attr, ok := d.GetOk("timezone"); ok {
dt.SetTimezone(attr.(string))
}

return &dt
}
Expand Down Expand Up @@ -259,6 +280,10 @@ func resourceDatadogDowntimeRead(d *schema.ResourceData, meta interface{}) error
return err
}

if err := d.Set("timezone", dt.GetTimezone()); err != nil {
return err
}

if r, ok := dt.GetRecurrenceOk(); ok {
recurrence := make(map[string]interface{})
recurrenceList := make([]map[string]interface{}, 0, 1)
Expand Down Expand Up @@ -305,6 +330,8 @@ func resourceDatadogDowntimeUpdate(d *schema.ResourceData, meta interface{}) err
if err = client.UpdateDowntime(dt); err != nil {
return fmt.Errorf("error updating downtime: %s", err.Error())
}
// handle the case when a downtime is replaced
d.SetId(strconv.Itoa(dt.GetId()))

return resourceDatadogDowntimeRead(d, meta)
}
Expand Down Expand Up @@ -354,3 +381,23 @@ func validateDatadogDowntimeRecurrenceWeekDays(v interface{}, k string) (ws []st
}
return
}

func validateDatadogDowntimeTimezone(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
switch strings.ToLower(value) {
case "utc", "":
break
case "local", "localtime":
// get current zone from machine
zone, _ := time.Now().Local().Zone()
return validateDatadogDowntimeRecurrenceType(zone, k)
default:
_, err := time.LoadLocation(value)
if err != nil {
errors = append(errors, fmt.Errorf(
"%q contains an invalid timezone parameter: %q, Valid parameters are IANA Time Zone names",
k, value))
}
}
return
}
8 changes: 4 additions & 4 deletions datadog/resource_datadog_integration_gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

const testAccCheckDatadogIntegrationGCPConfig = `
resource "datadog_integration_gcp" "awesome_gcp_project_integration" {
project_id = "awesome-project-id"
project_id = "super-awesome-project-id"
private_key_id = "1234567890123456789012345678901234567890"
private_key = "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
client_email = "awesome-service-account@awesome-project-id.iam.gserviceaccount.com"
Expand All @@ -21,7 +21,7 @@ resource "datadog_integration_gcp" "awesome_gcp_project_integration" {
`
const testAccCheckDatadogIntegrationGCPEmptyHostFiltersConfig = `
resource "datadog_integration_gcp" "awesome_gcp_project_integration" {
project_id = "awesome-project-id"
project_id = "super-awesome-project-id"
private_key_id = "1234567890123456789012345678901234567890"
private_key = "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
client_email = "awesome-service-account@awesome-project-id.iam.gserviceaccount.com"
Expand All @@ -41,7 +41,7 @@ func TestAccDatadogIntegrationGCP(t *testing.T) {
checkIntegrationGCPExists,
resource.TestCheckResourceAttr(
"datadog_integration_gcp.awesome_gcp_project_integration",
"project_id", "awesome-project-id"),
"project_id", "super-awesome-project-id"),
resource.TestCheckResourceAttr(
"datadog_integration_gcp.awesome_gcp_project_integration",
"private_key_id", "1234567890123456789012345678901234567890"),
Expand All @@ -65,7 +65,7 @@ func TestAccDatadogIntegrationGCP(t *testing.T) {
checkIntegrationGCPExists,
resource.TestCheckResourceAttr(
"datadog_integration_gcp.awesome_gcp_project_integration",
"project_id", "awesome-project-id"),
"project_id", "super-awesome-project-id"),
resource.TestCheckResourceAttr(
"datadog_integration_gcp.awesome_gcp_project_integration",
"private_key_id", "1234567890123456789012345678901234567890"),
Expand Down
Loading