diff --git a/cloud/aws/vpn/README.md b/cloud/aws/vpn/README.md new file mode 100644 index 0000000..4876c79 --- /dev/null +++ b/cloud/aws/vpn/README.md @@ -0,0 +1,31 @@ +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 | +| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no | +| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | +| message | Message sent when an alert is triggered | string | - | yes | diff --git a/cloud/aws/vpn/inputs.tf b/cloud/aws/vpn/inputs.tf new file mode 100644 index 0000000..ff336dc --- /dev/null +++ b/cloud/aws/vpn/inputs.tf @@ -0,0 +1,25 @@ +# 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" +} + +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 = "*" +} diff --git a/cloud/aws/vpn/monitors-vpn.tf b/cloud/aws/vpn/monitors-vpn.tf new file mode 100644 index 0000000..c86e01c --- /dev/null +++ b/cloud/aws/vpn/monitors-vpn.tf @@ -0,0 +1,31 @@ +data "template_file" "filter" { + template = "$${filter}" + + vars { + filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_aws_vpn:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}" + } +} + +resource "datadog_monitor" "VPN_status" { + name = "[${var.environment}] VPN Down" + message = "${var.message}" + + query = <