Skip to content

Commit ccd594f

Browse files
committed
Add 2 new variables: sns_topic_prefix and sns_topic_postfix
1 parent 3308475 commit ccd594f

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Terraform module that configures important elasticsearch alerts using CloudWatch
77

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

10-
`v1.0.0` supports terraform `v0.12` syntax!
10+
`v1.x` supports terraform `v0.12` syntax!
1111

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

@@ -81,6 +81,8 @@ module "es_alarms" {
8181
| `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 |
8282
| `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 |
8383
| `sns_topic` | SNS topic you want to specify. If leave empty, it will use a prefix and a timestampe appended | string | `""` | no |
84+
| `sns_topic_postfix` | SNS topic postfix | string | `""` | no |
85+
| `sns_topic_prefix` | SNS topic prefix | string | `""` | no |
8486

8587
## Outputs
8688

examples/simple/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module "es_alarms" {
1818
source = "../../"
1919
domain_name = "example"
2020
sns_topic = "elasticsearch-threshold-alerts"
21+
sns_topic_prefix = "prod-"
2122
min_available_nodes = "3"
2223
}
2324

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ data "aws_caller_identity" "default" {}
77
# Make a topic
88
resource "aws_sns_topic" "default_prefix" {
99
count = var.sns_topic == "" ? 1 : 0
10-
name_prefix = "elasticsearch-threshold-alerts"
10+
name_prefix = "${var.sns_topic_prefix}elasticsearch-threshold-alerts${var.sns_topc_postfix}"
1111
}
1212

1313
resource "aws_sns_topic" "default" {
1414
count = var.sns_topic != "" ? 1 : 0
15-
name = var.sns_topic
15+
name = "${var.sns_topic_prefix}${var.sns_topic}${var.sns_topic_postfix}"
1616
}
1717

1818
locals {

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ variable "alarm_name_postfix" {
2121
default = ""
2222
}
2323

24+
variable "sns_topic_prefix" {
25+
description = "SNS topic prefix"
26+
type = string
27+
default = ""
28+
}
29+
30+
variable "sns_topc_postfix" {
31+
description = "SNS topic postfix"
32+
type = string
33+
default = ""
34+
}
35+
2436
variable "monitor_cluster_status_is_red" {
2537
description = "Enable monitoring of cluster status is in red"
2638
type = bool

0 commit comments

Comments
 (0)