Skip to content

Instantly share code, notes, and snippets.

@MattBlack85
Created November 5, 2018 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattBlack85/5bfe1c38ba4591f71f96b8d764eb5dbf to your computer and use it in GitHub Desktop.
Save MattBlack85/5bfe1c38ba4591f71f96b8d764eb5dbf to your computer and use it in GitHub Desktop.
resource "aws_iot_topic_rule" "shadow_rejection_errors" {
name = "shadow_rejected_error"
description = "Add a metric to cloudwatch if any shadow fails update"
enabled = true
sql = "SELECT *, topic(3) as device_id FROM '$aws/things/+/shadow/update/rejected'"
sql_version = "2016-03-23"
cloudwatch_metric {
metric_name = "Rejected"
metric_namespace = "Shadow"
metric_value = "1"
metric_unit = "Count"
metric_timestamp = "${join("", list("$", "{timestamp()}"))}"
role_arn = "${var.iot_metrics_to_cloudwatch_arn}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment