Skip to content

Commit

Permalink
use common locals and inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aohzan committed Dec 12, 2023
1 parent 2791a98 commit c2c7217
Show file tree
Hide file tree
Showing 379 changed files with 1,056 additions and 741 deletions.
2 changes: 1 addition & 1 deletion caas/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Creates DataDog monitors with the following checks:
| <a name="input_not_responding_threshold_warning"></a> [not\_responding\_threshold\_warning](#input\_not\_responding\_threshold\_warning) | Docker does not respond monitor (warning threshold) | `string` | `3` | no |
| <a name="input_notify_no_data"></a> [notify\_no\_data](#input\_notify\_no\_data) | Will raise no data alert if set to true | `bool` | `true` | no |
| <a name="input_prefix_slug"></a> [prefix\_slug](#input\_prefix\_slug) | Prefix string to prepend between brackets on every monitors names | `string` | `""` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Global terraform | `list(string)` | <pre>[<br> "type:docker",<br> "provider:docker",<br> "resource:docker"<br>]</pre> | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Global variables | `list(string)` | <pre>[<br> "type:docker",<br> "provider:docker",<br> "resource:docker"<br>]</pre> | no |
| <a name="input_team"></a> [team](#input\_team) | n/a | `string` | `"claranet"` | no |
| <a name="input_timeout_h"></a> [timeout\_h](#input\_timeout\_h) | Default auto-resolving state (in hours) | `number` | `0` | no |

Expand Down
53 changes: 50 additions & 3 deletions caas/docker/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,58 @@
# Global variables

variable "tags" {
type = list(string)
default = ["type:docker", "provider:docker", "resource:docker"]
}

# Datadog monitors variables
# Global DataDog
variable "evaluation_delay" {
description = "Delay in seconds for the metric evaluation"
default = 15
}

variable "new_host_delay" {
description = "Delay in seconds before monitor new resource"
default = 300
}

variable "new_group_delay" {
description = "Delay in seconds before monitor new resource"
default = 300
}

variable "timeout_h" {
description = "Default auto-resolving state (in hours)"
default = 0
}

variable "prefix_slug" {
description = "Prefix string to prepend between brackets on every monitors names"
default = ""
}

variable "notify_no_data" {
description = "Will raise no data alert if set to true"
default = true
}

variable "message" {
description = "Message sent when an alert is triggered"
}

variable "filter_tags_use_defaults" {
description = "Use default filter tags convention"
default = "true"
}

variable "filter_tags_custom" {
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
default = "*"
}

variable "filter_tags_custom_excluded" {
description = "Tags excluded for custom filtering when filter_tags_use_defaults is false"
default = ""
}

#
# Not Responding
Expand Down Expand Up @@ -83,4 +130,4 @@ variable "memory_used_extra_tags" {
description = "Extra tags for Container Memory Usage monitor"
type = list(string)
default = []
}
}
4 changes: 3 additions & 1 deletion caas/kubernetes/ark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Creates DataDog monitors with the following checks:
| <a name="input_ark_schedules_monitor_message"></a> [ark\_schedules\_monitor\_message](#input\_ark\_schedules\_monitor\_message) | Custom message for Ark schedules monitor | `string` | `""` | no |
| <a name="input_ark_schedules_monitor_no_data_timeframe"></a> [ark\_schedules\_monitor\_no\_data\_timeframe](#input\_ark\_schedules\_monitor\_no\_data\_timeframe) | No data timeframe in minutes | `number` | `2880` | no |
| <a name="input_ark_schedules_monitor_timeframe"></a> [ark\_schedules\_monitor\_timeframe](#input\_ark\_schedules\_monitor\_timeframe) | Monitor timeframe for Ark schedules monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_1d"` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | Architecture environment | `any` | n/a | yes |
| <a name="input_environment"></a> [environment](#input\_environment) | Architecture Environment | `string` | n/a | yes |
| <a name="input_evaluation_delay"></a> [evaluation\_delay](#input\_evaluation\_delay) | Delay in seconds for the metric evaluation | `number` | `15` | no |
| <a name="input_filter_tags_custom"></a> [filter\_tags\_custom](#input\_filter\_tags\_custom) | Tags used for custom filtering when filter\_tags\_use\_defaults is false | `string` | `"*"` | no |
| <a name="input_filter_tags_custom_excluded"></a> [filter\_tags\_custom\_excluded](#input\_filter\_tags\_custom\_excluded) | Tags excluded for custom filtering when filter\_tags\_use\_defaults is false | `string` | `""` | no |
Expand All @@ -64,6 +64,8 @@ Creates DataDog monitors with the following checks:
| <a name="input_new_host_delay"></a> [new\_host\_delay](#input\_new\_host\_delay) | Delay in seconds before monitor new resource | `number` | `300` | no |
| <a name="input_notify_no_data"></a> [notify\_no\_data](#input\_notify\_no\_data) | Will raise no data alert if set to true | `bool` | `true` | no |
| <a name="input_prefix_slug"></a> [prefix\_slug](#input\_prefix\_slug) | Prefix string to prepend between brackets on every monitors names | `string` | `""` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Global variables | `list(string)` | <pre>[<br> "type:caas",<br> "provider:prometheus",<br> "resource:ark"<br>]</pre> | no |
| <a name="input_team"></a> [team](#input\_team) | n/a | `string` | `"claranet"` | no |
| <a name="input_timeout_h"></a> [timeout\_h](#input\_timeout\_h) | Default auto-resolving state (in hours) | `number` | `0` | no |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions caas/kubernetes/ark/common-inputs.tf
1 change: 1 addition & 0 deletions caas/kubernetes/ark/common-locals.tf
11 changes: 5 additions & 6 deletions caas/kubernetes/ark/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Datadog global variables

variable "environment" {
description = "Architecture environment"
# Global variables
variable "tags" {
type = list(string)
default = ["type:caas", "provider:prometheus", "resource:ark"]
}

# Global DataDog
variable "filter_tags_use_defaults" {
description = "Use default filter tags convention"
default = "true"
Expand Down Expand Up @@ -54,7 +55,6 @@ variable "notify_no_data" {
}

# Datadog monitors variables

variable "ark_schedules_monitor_message" {
description = "Custom message for Ark schedules monitor"
type = string
Expand Down Expand Up @@ -83,4 +83,3 @@ variable "ark_schedules_monitor_no_data_timeframe" {
description = "No data timeframe in minutes"
default = 2880
}

4 changes: 1 addition & 3 deletions caas/kubernetes/ark/monitors-ark.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ EOQ
}

evaluation_delay = var.evaluation_delay
new_host_delay = var.new_host_delay
new_group_delay = var.new_group_delay
no_data_timeframe = var.ark_schedules_monitor_no_data_timeframe

Expand All @@ -25,6 +24,5 @@ EOQ
include_tags = true
require_full_window = false

tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:ark", "team:claranet", "created-by:terraform"], var.ark_schedules_extra_tags)
tags = concat(local.common_tags, var.tags, var.ark_schedules_extra_tags)
}

4 changes: 3 additions & 1 deletion caas/kubernetes/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Creates DataDog monitors with the following checks:
| <a name="input_apiserver_message"></a> [apiserver\_message](#input\_apiserver\_message) | Custom message for API server monitor | `string` | `""` | no |
| <a name="input_apiserver_no_data_timeframe"></a> [apiserver\_no\_data\_timeframe](#input\_apiserver\_no\_data\_timeframe) | Number of minutes before reporting no data | `string` | `10` | no |
| <a name="input_apiserver_threshold_warning"></a> [apiserver\_threshold\_warning](#input\_apiserver\_threshold\_warning) | API server monitor (warning threshold) | `string` | `3` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | Architecture environment | `any` | n/a | yes |
| <a name="input_environment"></a> [environment](#input\_environment) | Architecture Environment | `string` | n/a | yes |
| <a name="input_evaluation_delay"></a> [evaluation\_delay](#input\_evaluation\_delay) | Delay in seconds for the metric evaluation | `number` | `15` | no |
| <a name="input_filter_tags_custom"></a> [filter\_tags\_custom](#input\_filter\_tags\_custom) | Tags used for custom filtering when filter\_tags\_use\_defaults is false | `string` | `"*"` | no |
| <a name="input_filter_tags_custom_excluded"></a> [filter\_tags\_custom\_excluded](#input\_filter\_tags\_custom\_excluded) | Tags excluded for custom filtering when filter\_tags\_use\_defaults is false | `string` | `""` | no |
Expand All @@ -65,6 +65,8 @@ Creates DataDog monitors with the following checks:
| <a name="input_new_host_delay"></a> [new\_host\_delay](#input\_new\_host\_delay) | Delay in seconds before monitor new resource | `number` | `300` | no |
| <a name="input_notify_no_data"></a> [notify\_no\_data](#input\_notify\_no\_data) | Will raise no data alert if set to true | `bool` | `true` | no |
| <a name="input_prefix_slug"></a> [prefix\_slug](#input\_prefix\_slug) | Prefix string to prepend between brackets on every monitors names | `string` | `""` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Global variables | `list(string)` | <pre>[<br> "type:caas",<br> "provider:kubernetes",<br> "resource:kubernetes-node"<br>]</pre> | no |
| <a name="input_team"></a> [team](#input\_team) | n/a | `string` | `"claranet"` | no |
| <a name="input_timeout_h"></a> [timeout\_h](#input\_timeout\_h) | Default auto-resolving state (in hours) | `number` | `0` | no |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions caas/kubernetes/cluster/common-inputs.tf
1 change: 1 addition & 0 deletions caas/kubernetes/cluster/common-locals.tf
9 changes: 5 additions & 4 deletions caas/kubernetes/cluster/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Datadog global variables

variable "environment" {
description = "Architecture environment"
# Global variables
variable "tags" {
type = list(string)
default = ["type:caas", "provider:kubernetes", "resource:kubernetes-node"]
}

# Datadog global variables
variable "filter_tags_use_defaults" {
description = "Use default filter tags convention"
default = "true"
Expand Down
3 changes: 1 addition & 2 deletions caas/kubernetes/cluster/monitors-k8s-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.apiserver_extra_tags)
tags = concat(local.common_tags, var.tags, var.apiserver_extra_tags)
}

2 changes: 2 additions & 0 deletions caas/kubernetes/ingress/vts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Creates DataDog monitors with the following checks:
| <a name="input_new_host_delay"></a> [new\_host\_delay](#input\_new\_host\_delay) | Delay in seconds before monitor new resource | `number` | `300` | no |
| <a name="input_notify_no_data"></a> [notify\_no\_data](#input\_notify\_no\_data) | Will raise no data alert if set to true | `bool` | `true` | no |
| <a name="input_prefix_slug"></a> [prefix\_slug](#input\_prefix\_slug) | Prefix string to prepend between brackets on every monitors names | `string` | `""` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Global variables | `list(string)` | <pre>[<br> "type:caas",<br> "provider:prometheus",<br> "resource:nginx-ingress-controller"<br>]</pre> | no |
| <a name="input_team"></a> [team](#input\_team) | n/a | `string` | `"claranet"` | no |
| <a name="input_timeout_h"></a> [timeout\_h](#input\_timeout\_h) | Default auto-resolving state (in hours) | `number` | `0` | no |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions caas/kubernetes/ingress/vts/common-inputs.tf
1 change: 1 addition & 0 deletions caas/kubernetes/ingress/vts/common-locals.tf
8 changes: 4 additions & 4 deletions caas/kubernetes/ingress/vts/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Global Terraform
variable "environment" {
description = "Architecture Environment"
type = string
# Global variables
variable "tags" {
type = list(string)
default = ["type:caas", "provider:prometheus", "resource:nginx-ingress-controller"]
}

# Global DataDog
Expand Down
4 changes: 2 additions & 2 deletions caas/kubernetes/ingress/vts/monitors-ingress.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_5xx_extra_tags)
tags = concat(local.common_tags, var.tags, var.ingress_5xx_extra_tags)
}

resource "datadog_monitor" "nginx_ingress_too_many_4xx" {
Expand Down Expand Up @@ -57,6 +57,6 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_4xx_extra_tags)
tags = concat(local.common_tags, var.tags, var.ingress_4xx_extra_tags)
}

4 changes: 3 additions & 1 deletion caas/kubernetes/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Creates DataDog monitors with the following checks:
| <a name="input_disk_pressure_extra_tags"></a> [disk\_pressure\_extra\_tags](#input\_disk\_pressure\_extra\_tags) | Extra tags for Disk pressure monitor | `list(string)` | `[]` | no |
| <a name="input_disk_pressure_message"></a> [disk\_pressure\_message](#input\_disk\_pressure\_message) | Custom message for Disk pressure monitor | `string` | `""` | no |
| <a name="input_disk_pressure_threshold_warning"></a> [disk\_pressure\_threshold\_warning](#input\_disk\_pressure\_threshold\_warning) | Disk pressure monitor (warning threshold) | `string` | `3` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | Architecture environment | `any` | n/a | yes |
| <a name="input_environment"></a> [environment](#input\_environment) | Architecture Environment | `string` | n/a | yes |
| <a name="input_evaluation_delay"></a> [evaluation\_delay](#input\_evaluation\_delay) | Delay in seconds for the metric evaluation | `number` | `15` | no |
| <a name="input_filter_tags_custom"></a> [filter\_tags\_custom](#input\_filter\_tags\_custom) | Tags used for custom filtering when filter\_tags\_use\_defaults is false | `string` | `"*"` | no |
| <a name="input_filter_tags_custom_excluded"></a> [filter\_tags\_custom\_excluded](#input\_filter\_tags\_custom\_excluded) | Tags excluded for custom filtering when filter\_tags\_use\_defaults is false | `string` | `""` | no |
Expand Down Expand Up @@ -109,6 +109,8 @@ Creates DataDog monitors with the following checks:
| <a name="input_ready_extra_tags"></a> [ready\_extra\_tags](#input\_ready\_extra\_tags) | Extra tags for Node ready monitor | `list(string)` | `[]` | no |
| <a name="input_ready_message"></a> [ready\_message](#input\_ready\_message) | Custom message for Node ready monitor | `string` | `""` | no |
| <a name="input_ready_threshold_warning"></a> [ready\_threshold\_warning](#input\_ready\_threshold\_warning) | Node ready monitor (warning threshold) | `string` | `3` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Global variables | `list(string)` | <pre>[<br> "type:caas",<br> "provider:kubernetes",<br> "resource:kubernetes-node"<br>]</pre> | no |
| <a name="input_team"></a> [team](#input\_team) | n/a | `string` | `"claranet"` | no |
| <a name="input_timeout_h"></a> [timeout\_h](#input\_timeout\_h) | Default auto-resolving state (in hours) | `number` | `0` | no |
| <a name="input_unregister_net_device_enabled"></a> [unregister\_net\_device\_enabled](#input\_unregister\_net\_device\_enabled) | Flag to enable Unregister net device monitor | `string` | `"true"` | no |
| <a name="input_unregister_net_device_extra_tags"></a> [unregister\_net\_device\_extra\_tags](#input\_unregister\_net\_device\_extra\_tags) | Extra tags for Unregister net device monitor | `list(string)` | `[]` | no |
Expand Down
1 change: 1 addition & 0 deletions caas/kubernetes/node/common-inputs.tf
1 change: 1 addition & 0 deletions caas/kubernetes/node/common-locals.tf
9 changes: 5 additions & 4 deletions caas/kubernetes/node/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Datadog global variables

variable "environment" {
description = "Architecture environment"
# Global variables
variable "tags" {
type = list(string)
default = ["type:caas", "provider:kubernetes", "resource:kubernetes-node"]
}

# Global DataDog
variable "filter_tags_use_defaults" {
description = "Use default filter tags convention"
default = "true"
Expand Down
20 changes: 10 additions & 10 deletions caas/kubernetes/node/monitors-k8s-node.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.disk_pressure_extra_tags)
tags = concat(local.common_tags, var.tags, var.disk_pressure_extra_tags)
}

resource "datadog_monitor" "disk_out" {
Expand All @@ -49,7 +49,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.disk_out_extra_tags)
tags = concat(local.common_tags, var.tags, var.disk_out_extra_tags)
}

resource "datadog_monitor" "memory_pressure" {
Expand All @@ -76,7 +76,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.memory_pressure_extra_tags)
tags = concat(local.common_tags, var.tags, var.memory_pressure_extra_tags)
}

resource "datadog_monitor" "ready" {
Expand All @@ -103,7 +103,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.ready_extra_tags)
tags = concat(local.common_tags, var.tags, var.ready_extra_tags)
}

resource "datadog_monitor" "kubelet_ping" {
Expand Down Expand Up @@ -131,7 +131,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.kubelet_ping_extra_tags)
tags = concat(local.common_tags, var.tags, var.kubelet_ping_extra_tags)
}

resource "datadog_monitor" "kubelet_syncloop" {
Expand All @@ -158,7 +158,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.kubelet_syncloop_extra_tags)
tags = concat(local.common_tags, var.tags, var.kubelet_syncloop_extra_tags)
}

resource "datadog_monitor" "unregister_net_device" {
Expand All @@ -176,7 +176,7 @@ resource "datadog_monitor" "unregister_net_device" {
timeout_h = var.timeout_h
include_tags = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.unregister_net_device_extra_tags)
tags = concat(local.common_tags, var.tags, var.unregister_net_device_extra_tags)
}

resource "datadog_monitor" "node_unschedulable" {
Expand Down Expand Up @@ -205,7 +205,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.node_unschedulable_extra_tags)
tags = concat(local.common_tags, var.tags, var.node_unschedulable_extra_tags)
}

resource "datadog_monitor" "volume_space" {
Expand Down Expand Up @@ -236,7 +236,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_space_extra_tags)
tags = concat(local.common_tags, var.tags, var.volume_space_extra_tags)
}

resource "datadog_monitor" "volume_inodes" {
Expand Down Expand Up @@ -267,5 +267,5 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_inodes_extra_tags)
tags = concat(local.common_tags, var.tags, var.volume_inodes_extra_tags)
}
Loading

0 comments on commit c2c7217

Please sign in to comment.