Skip to content

Commit

Permalink
update code for all type of dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnagpal committed Jun 25, 2020
1 parent 6d8dd8d commit 1a4dc29
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 34 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@


<h1 align="center">
terraform-aws-cloudwatch-alarms
Terraform AWS Cloudwatch Alarms
</h1>

<p align="center" style="font-size: 1.2rem;">
<p align="center" style="font-size: 1.2rem;">
Terraform module creates Cloudwatch Alarm on AWS for monitoriing AWS services.
</p>

Expand All @@ -27,18 +27,18 @@
<a href='https://facebook.com/sharer/sharer.php?u=https://github.com/clouddrove/terraform-aws-cloudwatch-alarms'>
<img title="Share on Facebook" src="https://user-images.githubusercontent.com/50652676/62817743-4f64cb80-bb59-11e9-90c7-b057252ded50.png" />
</a>
<a href='https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-cloudwatch-alarms&url=https://github.com/clouddrove/terraform-aws-cloudwatch-alarms'>
<a href='https://www.linkedin.com/shareArticle?mini=true&title=Terraform+AWS+Cloudwatch+Alarms&url=https://github.com/clouddrove/terraform-aws-cloudwatch-alarms'>
<img title="Share on LinkedIn" src="https://user-images.githubusercontent.com/50652676/62817742-4e339e80-bb59-11e9-87b9-a1f68cae1049.png" />
</a>
<a href='https://twitter.com/intent/tweet/?text=terraform-aws-cloudwatch-alarms&url=https://github.com/clouddrove/terraform-aws-cloudwatch-alarms'>
<a href='https://twitter.com/intent/tweet/?text=Terraform+AWS+Cloudwatch+Alarms&url=https://github.com/clouddrove/terraform-aws-cloudwatch-alarms'>
<img title="Share on Twitter" src="https://user-images.githubusercontent.com/50652676/62817740-4c69db00-bb59-11e9-8a79-3580fbbf6d5c.png" />
</a>

</p>
<hr>


We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.
We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.

This module is basically combination of [Terraform open source](https://www.terraform.io/) and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.

Expand All @@ -49,7 +49,7 @@ We have [*fifty plus terraform modules*][terraform_modules]. A few of them are c

## Prerequisites

This module has a few dependencies:
This module has a few dependencies:

- [Terraform 0.12](https://learn.hashicorp.com/terraform/getting-started/install.html)
- [Go](https://golang.org/doc/install)
Expand All @@ -72,7 +72,7 @@ This module has a few dependencies:
Here is an example of how you can use this module in your inventory structure:
```hcl
module "alarm" {
source = "https://github.com/clouddrove/terraform-aws-cloudwatch-alarms.git?ref=tags/0.12.1"
source = "https://github.com/clouddrove/terraform-aws-cloudwatch-alarms.git?ref=tags/0.12.2"
name = "alarm"
application = "clouddrove"
environment = "test"
Expand All @@ -90,8 +90,9 @@ Here is an example of how you can use this module in your inventory structure:
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
instance_id = "XXXXXXXXXXXXXXXXX"
dimensions = {
instance_id = "i-xxxxxxxxxxxxx"
}
}
```

Expand All @@ -110,6 +111,7 @@ Here is an example of how you can use this module in your inventory structure:
| alarm\_name | The descriptive name for the alarm. | string | n/a | yes |
| application | Application \(e.g. `cd` or `clouddrove`\). | string | `""` | no |
| comparison\_operator | The arithmetic operation to use when comparing the specified Statistic and Threshold. | string | n/a | yes |
| dimensions | Dimensions for metrics. | map | `<map>` | no |
| enabled | Enable alarm. | bool | `"true"` | no |
| environment | Environment \(e.g. `prod`, `dev`, `staging`\). | string | `""` | no |
| evaluation\_periods | The number of periods over which data is compared to the specified threshold. | number | n/a | yes |
Expand Down Expand Up @@ -137,7 +139,7 @@ Here is an example of how you can use this module in your inventory structure:


## Testing
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.

You need to run the following command in the testing folder:
```hcl
Expand All @@ -146,7 +148,7 @@ You need to run the following command in the testing folder:



## Feedback
## Feedback
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/terraform-aws-cloudwatch-alarms/issues), or feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com).

If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/terraform-aws-cloudwatch-alarms)!
Expand Down
23 changes: 6 additions & 17 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

# Name of this project
name : terraform-aws-cloudwatch-alarms
name : Terraform AWS Cloudwatch Alarms

# License of this project
license: "MIT"
Expand All @@ -22,12 +22,6 @@ badges:
image: "https://img.shields.io/badge/License-MIT-blue.svg"
url: "LICENSE.md"

# Related Projects of this project
related:
- name: "terraform-aws-ec2"
description: "Terraform module to create an EC2 with Elastic IP Addresses and Elastic Block Store."
url: "https://github.com/clouddrove/terraform-aws-ec2"

# description of this project
description: |-
Terraform module creates Cloudwatch Alarm on AWS for monitoriing AWS services.
Expand All @@ -42,7 +36,7 @@ usage : |-
Here is an example of how you can use this module in your inventory structure:
```hcl
module "alarm" {
source = "https://github.com/clouddrove/terraform-aws-cloudwatch-alarms.git?ref=tags/0.12.1"
source = "https://github.com/clouddrove/terraform-aws-cloudwatch-alarms.git?ref=tags/0.12.2"
name = "alarm"
application = "clouddrove"
environment = "test"
Expand All @@ -60,13 +54,8 @@ usage : |-
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
instance_id = "XXXXXXXXXXXXXXXXX"
dimensions = {
instance_id = "i-xxxxxxxxxxxxx"
}
}
```
# Contributors to this project
contributors:
- name: "Nikita Dugar"
github: "nikitadugar"
- name: "Sohan Yadav"
github: "sohanyadav"
```
6 changes: 3 additions & 3 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ provider "aws" {
region = "eu-west-1"
}



module "vpc" {
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git"

Expand Down Expand Up @@ -105,5 +103,7 @@ module "alarm" {
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
instance_id = module.ec2.instance_id[0]
dimensions = {
instance_id = module.ec2.instance_id[0]
}
}
4 changes: 1 addition & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@ resource "aws_cloudwatch_metric_alarm" "default" {
ok_actions = var.ok_actions
tags = module.labels.tags

dimensions = {
InstanceId = var.instance_id
}
dimensions = var.dimensions
}
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,9 @@ variable "instance_id" {
type = string
default = ""
description = "The instance ID."
}

variable "dimensions" {
default = {}
description = "Dimensions for metrics."
}

0 comments on commit 1a4dc29

Please sign in to comment.