From e94ae0dcb71e6d642ad4e23ab6cf77517e0f69d7 Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Mon, 19 Feb 2018 16:52:13 +0100 Subject: [PATCH] MON-91 - Update inputs and add README --- cloud/aws/vpn/README.md | 33 +++++++++++++++++++++ cloud/aws/vpn/inputs.tf | 56 +++++++++++++++++++++++------------ cloud/aws/vpn/monitors-vpn.tf | 33 ++++++++------------- inputs.tf | 7 ----- 4 files changed, 83 insertions(+), 46 deletions(-) create mode 100644 cloud/aws/vpn/README.md diff --git a/cloud/aws/vpn/README.md b/cloud/aws/vpn/README.md new file mode 100644 index 0000000..21a545d --- /dev/null +++ b/cloud/aws/vpn/README.md @@ -0,0 +1,33 @@ +AWS VPN DataDog monitors +=============================== + +How to use this module +---------------------- + +``` +module "vpn" { + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/vpn?ref=MON-91-added-aws-vpn-state-check" + + environment = "${var.environment}" + message = "${module.datadog-message-alerting.alerting-message}" + vpn_tunnel_address = "${var.vpn_to_monitor}" +} +``` + +Purpose +------- +Creates a DataDog monitors with the following checks : +* VPN status + +Inputs +------- + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| environment | Architecture Environment | string | - | yes | +| evaluation_delay | Delay in seconds for the metric evaluation | string | `600` | no | +| message | Message sent when an alert is triggered | string | - | yes | +| vpn_status_critical | Both tunnels are down | string | `0` | no | +| vpn_status_ok | Both tunnels are up, everything is ok | string | `2` | no | +| vpn_status_warning | Only one tunnel is up | string | `1` | no | +| vpn_tunnel_address | List the VPN tunnels you want to monitor | list | `` | no | diff --git a/cloud/aws/vpn/inputs.tf b/cloud/aws/vpn/inputs.tf index ebcbed7..e1e3ade 100644 --- a/cloud/aws/vpn/inputs.tf +++ b/cloud/aws/vpn/inputs.tf @@ -1,19 +1,37 @@ -variable env {} - -variable "vpn_tunnel_address" { - description = "List the VPN tunnels you want to monitor" - type = "list" - default = [] -} - -variable "vpn_config" { - description = "Ok means that both tunnels are up, warning means only one tunnel is up and critical means that both tunnels are down " - type = "map" - - default = { - delay = 900 - warning = 1 - critical = 0 - ok = 2 - } -} +# Global Terraform +variable "environment" { + description = "Architecture Environment" + type = "string" +} + +# Global DataDog +variable "evaluation_delay" { + description = "Delay in seconds for the metric evaluation" + default = 600 +} + +variable "message" { + description = "Message sent when an alert is triggered" +} + +# AWS VPN Service specific +variable "vpn_tunnel_address" { + description = "List the VPN tunnels you want to monitor" + type = "list" + default = [] +} + +variable "vpn_status_ok" { + description = "Both tunnels are up, everything is ok" + default = 2 +} + +variable "vpn_status_warning" { + description = "Only one tunnel is up" + default = 1 +} + +variable "vpn_status_critical" { + description = "Both tunnels are down" + default = 0 +} diff --git a/cloud/aws/vpn/monitors-vpn.tf b/cloud/aws/vpn/monitors-vpn.tf index 01b2678..25501be 100644 --- a/cloud/aws/vpn/monitors-vpn.tf +++ b/cloud/aws/vpn/monitors-vpn.tf @@ -1,37 +1,30 @@ -module "message" { - source = "../../common/alerting-message" - oncall_24x7 = "${var.hno_escalation_group}" - oncall_office_hours = "${var.ho_escalation_group}" -} - resource "datadog_monitor" "VPN_status" { - name = "[${var.env}] VPN Down {{ tunnelipaddress }}" - message = "${module.message.alerting-message}" + name = "[${var.environment}] VPN Down {{ tunnelipaddress }}" + message = "${var.message}" query = <