Skip to content

Commit

Permalink
Create sanitech-telemetry.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Apr 19, 2024
1 parent 95f04c1 commit 30e1c35
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions func/sanitech-telemetry.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
provider "aws" {
region = "us-east-1"
}

resource "aws_cloudwatch_log_group" "sanitech_telemetry" {
name = "sanitech-telemetry"
}

resource "aws_cloudwatch_log_stream" "sanitech_telemetry" {
name = "sanitech-telemetry"
log_group_name = aws_cloudwatch_log_group.sanitech_telemetry.name
}

resource "aws_iot_thing" "sanitech_device" {
name = "sanitech-device"
}

resource "aws_iot_topic_rule" "sanitech_telemetry" {
name = "sanitech-telemetry"
topic_rule_payload = jsonencode({
sql = "SELECT * FROM 'sanitech/telemetry'"
actions = [{
cloudwatch = {
log_group_name = aws_cloudwatch_log_group.sanitech_telemetry.name
log_stream_name = aws_cloudwatch_log_stream.sanitech_telemetry.name
}
}]
})
}

resource "aws_iot_topic_subscription" "sanitech_telemetry" {
topic = "sanitech/telemetry"
thing = aws_iot_thing.sanitech_device.name
}

0 comments on commit 30e1c35

Please sign in to comment.