Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ module "lightstep_aurora_dashboard" {
lightstep_project = var.lightstep_project
}

module "lightstep_cloudfront_dashboard" {
source = "./modules/cloudfront-dashboard"
lightstep_project = var.lightstep_project
}

module "lightstep_inspector_dashboard" {
source = "./modules/inspector-dashboard"
lightstep_project = var.lightstep_project
Expand All @@ -93,4 +98,4 @@ module "lightstep_inspector_dashboard" {
module "lightstep_natgateway_dashboard" {
source = "./modules/natgateway-dashboard"
lightstep_project = var.lightstep_project
}
}
116 changes: 116 additions & 0 deletions modules/cloudfront-dashboard/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
terraform {
required_providers {
lightstep = {
source = "lightstep/lightstep"
version = "~> 1.60.2"
}
}
required_version = ">= v1.0.11"
}

resource "lightstep_metric_dashboard" "aws_cloudfront_dashboard" {
project_name = var.lightstep_project
dashboard_name = "AWS CloudFront"

chart {
name = "Requests"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "bar"
hidden = false

metric = "aws.cloudfront.requests_count"
timeseries_operator = "delta"


group_by {
aggregation_method = "sum"
keys = ["DistributionId", ]
}

}

}

chart {
name = "4xx Error Rate"
rank = "1"
type = "timeseries"

query {
query_name = "a"
display = "bar"
hidden = false

metric = "aws.cloudfront.4_xx_error_rate_count"
timeseries_operator = "delta"


group_by {
aggregation_method = "sum"
keys = ["DistributionId", ]
}

}

query {
query_name = "b"
display = "bar"
hidden = false

metric = "aws.cloudfront.5xx_error_rate_count"
timeseries_operator = "delta"


group_by {
aggregation_method = "sum"
keys = ["DistributionId", ]
}

}

}

chart {
name = "Bytes Downloaded"
rank = "2"
type = "timeseries"

query {
query_name = "a"
display = "bar"
hidden = false

metric = "aws.cloudfront.bytes_downloaded_count"
timeseries_operator = "delta"


group_by {
aggregation_method = "sum"
keys = ["DistributionId", ]
}

}

query {
query_name = "b"
display = "bar"
hidden = false

metric = "aws.cloudfront.bytes_uploaded_count"
timeseries_operator = "delta"


group_by {
aggregation_method = "sum"
keys = ["DistributionId", ]
}

}

}

}
4 changes: 4 additions & 0 deletions modules/cloudfront-dashboard/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "dashboard_url" {
value = "https://app.lightstep.com/${var.lightstep_project}/dashboard/${lightstep_metric_dashboard.aws_cloudfront_dashboard.id}"
description = "CLOUDFRONT Dashboard URL"
}
4 changes: 4 additions & 0 deletions modules/cloudfront-dashboard/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "lightstep_project" {
description = "Name of Lightstep project"
type = string
}
4 changes: 4 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ output "lightstep_aurora_dashboard_url" {
description = "Lightstep AWS Aurora Dashboard URL"
}

output "lightstep_cloudfront_dashboard_url" {
value = module.lightstep_cloudfront_dashboard.dashboard_url
description = "Lightstep AWS CLOUDFRONT Dashboard URL"

output "lightstep_inspector_dashboard_url" {
value = module.lightstep_inspector_dashboard.dashboard_url
description = "Lightstep AWS Inspector Dashboard URL"
Expand Down