Skip to content

Commit

Permalink
Added scheduling options (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
zdmytriv authored Aug 16, 2023
1 parent 501f648 commit 97ad006
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ We highly recommend that in your code you pin the version to the exact version y
using so that your infrastructure remains stable, and update versions in a
systematic way so that they do not catch you by surprise.

Also, because of a bug in the Terraform registry ([hashicorp/terraform#21417](https://github.com/hashicorp/terraform/issues/21417)),
the registry shows many of our inputs as required when in fact they are optional.
The table below correctly indicates which inputs are required.



Provision Datadog monitors from the catalog of YAML definitions:
Expand Down
4 changes: 2 additions & 2 deletions examples/rbac/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "monitor_configs" {
source = "cloudposse/config/yaml"
version = "0.8.1"
version = "1.0.2"

map_config_local_base_path = path.module
map_config_paths = var.monitor_paths
Expand All @@ -10,7 +10,7 @@ module "monitor_configs" {

module "role_configs" {
source = "cloudposse/config/yaml"
version = "0.8.1"
version = "1.0.2"

map_config_local_base_path = path.module
map_config_paths = var.role_paths
Expand Down
14 changes: 14 additions & 0 deletions modules/monitors/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ resource "datadog_monitor" "default" {
trigger_window = lookup(each.value.threshold_windows, "trigger_window", null)
}

dynamic "scheduling_options" {
for_each = lookup(each.value, "scheduling_options", [])
content {
dynamic "evaluation_window" {
for_each = lookup(scheduling_options.value, "evaluation_window", [])
content {
day_starts = lookup(evaluation_window.value, "day_starts", null)
hour_starts = lookup(evaluation_window.value, "hour_starts", null)
month_starts = lookup(evaluation_window.value, "month_starts", null)
}
}
}
}

# Assign restricted roles
# Only these roles will have access to the monitor according to their permissions
restricted_roles = try(var.restricted_roles_map[each.key], null)
Expand Down
2 changes: 1 addition & 1 deletion modules/monitors/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
datadog = {
source = "datadog/datadog"
version = ">= 3.0.0"
version = ">= 3.18.0"
}
}
}
2 changes: 1 addition & 1 deletion modules/synthetics/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ locals {
enabled = module.this.enabled
alert_tags = local.enabled && var.alert_tags != null ? format("%s%s", var.alert_tags_separator, join(var.alert_tags_separator, var.alert_tags)) : ""

all_public_locations = sort(keys({ for k, v in data.datadog_synthetics_locations.public_locations.locations : k => v if ! (length(regexall(".*pl:.*", k)) > 0) }))
all_public_locations = sort(keys({ for k, v in data.datadog_synthetics_locations.public_locations.locations : k => v if !(length(regexall(".*pl:.*", k)) > 0) }))
}

data "datadog_synthetics_locations" "public_locations" {}
Expand Down

0 comments on commit 97ad006

Please sign in to comment.