generated from clouddrove/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.yaml
132 lines (113 loc) · 4.23 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: Terraform AWS Cloudwatch Dashboard
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-cloudwatch-dashboard
# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v0.13-green"
url: "https://www.terraform.io"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-cloudwatch-dashboard/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-cloudwatch-dashboard/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"
# Prerequesties to display
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.6.4"
providers:
- name: aws
url: https://aws.amazon.com/
version: ">= 5.1.0"
module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-aws-labels
description: Provides resource tagging.
# description of this project
description: |-
Terraform module creates Cloudwatch Dashboard on AWS for monitoriing AWS services.
# How to use this project
# yamllint disable rule:line-length
usage: |-
Here are the example of how you can use this module in your inventory structure:
### Complete Example
```hcl
locals {
name = "dashboard"
environment = "test"
region = "us-east-1"
}
##-----------------------------------------------------------------------------
## LAMBDA
##-----------------------------------------------------------------------------
module "lambda" {
source = "clouddrove/lambda/aws"
version = "1.3.1"
name = "${local.name}-lambda-function"
environment = local.environment
enable = true
timeout = 60
runtime = "python3.8"
handler = "index.lambda_handler"
filename = "./test-dashboard-lambda-function.zip"
layer_filenames = ["./test-dashboard-lambda-function.zip"]
names = ["python_layer"]
compatible_runtimes = [["python3.8"]]
iam_actions = ["logs:CreateLogStream", "logs:CreateLogGroup", "logs:PutLogEvents"]
statement_ids = ["AllowExecutionFromCloudWatch"]
actions = ["lambda:InvokeFunction"]
principals = ["apigateway.amazonaws.com"]
reserved_concurrent_executions = null
}
##-----------------------------------------------------------------------------
## CLOUDWATCH DASHBOARD
##-----------------------------------------------------------------------------
module "cloudwatch_dashboard" {
source = "clouddrove/cloudwatch-dashboard/aws"
version = "1.0.0"
enable = true
name = local.name
environment = local.environment
dashboard_body = templatefile("${path.module}/lambda_dashboard.json", {
region = local.region
lambda_function_name = split(":", module.lambda.arn)[6]
})
}
output "dashboard_arn" {
value = module.cloudwatch_dashboard.dashboard_arn
}
```
### ECR Dashboard Example
```hcl
locals {
name = "dashboard"
environment = "test"
region = "us-east-1"
}
##-----------------------------------------------------------------------------
## CLOUDWATCH DASHBOARD
##-----------------------------------------------------------------------------
module "cloudwatch_dashboard" {
source = "clouddrove/cloudwatch-dashboard/aws"
version = "1.0.0"
enable = true
name = local.name
environment = local.environment
dashboard_body = templatefile("${path.module}/ecr_dashboard.json", {
region = local.region
})
}
```