Skip to content

Commit

Permalink
Add 2 new variables: sns_topic_prefix and sns_topic_postfix
Browse files Browse the repository at this point in the history
  • Loading branch information
dubiety committed Jul 15, 2020
1 parent 3308475 commit ccd594f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Terraform module that configures important elasticsearch alerts using CloudWatch

Create a set of sane Elasticsearch CloudWatch alerts for monitoring the health of an elasticsearch cluster.

`v1.0.0` supports terraform `v0.12` syntax!
`v1.x` supports terraform `v0.12` syntax!

This project is inspired by [CloudPosse](https://github.com/cloudposse)

Expand Down Expand Up @@ -81,6 +81,8 @@ module "es_alarms" {
| `monitor_master_cpu_utilization_too_high` | Enable monitoring of CPU utilization of master nodes are too high. Only enable this when dedicated master is enabled | string | `false` | no |
| `monitor_master_jvm_memory_pressure_too_high` | Enable monitoring of JVM memory pressure of master nodes are too high. Only enable this wwhen dedicated master is enabled | string | `false` | no |
| `sns_topic` | SNS topic you want to specify. If leave empty, it will use a prefix and a timestampe appended | string | `""` | no |
| `sns_topic_postfix` | SNS topic postfix | string | `""` | no |
| `sns_topic_prefix` | SNS topic prefix | string | `""` | no |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module "es_alarms" {
source = "../../"
domain_name = "example"
sns_topic = "elasticsearch-threshold-alerts"
sns_topic_prefix = "prod-"
min_available_nodes = "3"
}

Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ data "aws_caller_identity" "default" {}
# Make a topic
resource "aws_sns_topic" "default_prefix" {
count = var.sns_topic == "" ? 1 : 0
name_prefix = "elasticsearch-threshold-alerts"
name_prefix = "${var.sns_topic_prefix}elasticsearch-threshold-alerts${var.sns_topc_postfix}"

This comment has been minimized.

Copy link
@StefanMihail

StefanMihail Oct 2, 2020

typo in ${var.sns_topc_postfix}" it should be ${var.sns_topic_postfix}"

This comment has been minimized.

Copy link
@dubiety

dubiety Oct 4, 2020

Author Owner

Thank you for pointing this out. This is fixed in v1.0.3

}

resource "aws_sns_topic" "default" {
count = var.sns_topic != "" ? 1 : 0
name = var.sns_topic
name = "${var.sns_topic_prefix}${var.sns_topic}${var.sns_topic_postfix}"
}

locals {
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ variable "alarm_name_postfix" {
default = ""
}

variable "sns_topic_prefix" {
description = "SNS topic prefix"
type = string
default = ""
}

variable "sns_topc_postfix" {

This comment has been minimized.

Copy link
@StefanMihail

StefanMihail Oct 2, 2020

typo in "sns_topc_postfix" it should be var.sns_topic_postfix"

description = "SNS topic postfix"
type = string
default = ""
}

variable "monitor_cluster_status_is_red" {
description = "Enable monitoring of cluster status is in red"
type = bool
Expand Down

0 comments on commit ccd594f

Please sign in to comment.