https://github.com/insight-architectures/terraform-cloudwatch-dashboard
A series of Terraform modules that can be used to populate a dashboard built with AWS CloudWatch
https://github.com/insight-architectures/terraform-cloudwatch-dashboard
aws-cloudwatch-dashboard terraform-module
Last synced: about 2 months ago
JSON representation
A series of Terraform modules that can be used to populate a dashboard built with AWS CloudWatch
- Host: GitHub
- URL: https://github.com/insight-architectures/terraform-cloudwatch-dashboard
- Owner: insight-architectures
- License: mit
- Created: 2022-07-21T07:28:27.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-21T18:05:31.000Z (almost 3 years ago)
- Last Synced: 2025-02-05T20:01:34.543Z (4 months ago)
- Topics: aws-cloudwatch-dashboard, terraform-module
- Language: HCL
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform CloudWatch Dashboard Modules
This repository contains a series of Terraform modules that can be used to populate a dashboard built with AWS CloudWatch.
The modules of this repository are built around the concept of _columns_. This allows for a quicker and easier placement of the widgets over the canvas.
## Getting started
First of all, we need to define the columns that we will be using in our dashboard.
```terraform
locals {
columns = [
{size = 6},
{size = 9},
{size = 5},
{size = 4}
]
}# The sum should not exceed 24
```Then, we can use this repository to create a simple widget
```terraform
module "my_first_widget" {
source = "https://github.com/insight-architectures/terraform-cloudwatch-dashboard//modules/widget"
title = "Number of objects"
columns = local.columns
column = 1
height = 3
type = "metric"
region = "eu-north-1"
view = "singleValue"
metrics = [
[ "AWS/S3", "NumberOfObjects", "StorageType", "AllStorageTypes", "BucketName", "my_sample_bucket" ],
]
properties = {
sparkline = false
}
}
```Finally, we attach our widget to a `aws_cloudwatch_dashboard`.
```terraform
resource "aws_cloudwatch_dashboard" "sample" {
dashboard_name = "sample"
dashboard_body = jsonencode({
widgets = [
module.my_first_widget.widget
]
})
}
```