Skip to content

Commit 2716203

Browse files
author
Charlie Chen
committed
Add sns_topic_name as output
1 parent 4fe2cb7 commit 2716203

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ module "es_alarms" {
8484

8585
| Name | Description |
8686
|------|-------------|
87-
| `sns_topic_arn` | The ARN of the SNS topic |
87+
| `sns_topic_arn` | The ARN of the SNS topic |
88+
| `sns_topic_name` | The SNS topic name |
8889

8990
## Share the Love
9091

main.tf

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# resource "aws_cloudwatch_event_target" "sns" {
2-
# rule = "${aws_cloudwatch_event_rule.default.name}"
3-
# target_id = "SendToSNS"
4-
# arn = "${var.sns_topic_arn}"
5-
# depends_on = ["aws_cloudwatch_event_rule.default"]
6-
# input = "${var.sns_message_override}"
7-
# }
81
terraform {
92
backend "s3" {}
103
}
@@ -26,6 +19,10 @@ locals {
2619
aws_sns_topic_arn = "${var.sns_topic == "" ?
2720
element(concat(aws_sns_topic.default_prefix.*.arn, list("")), 0) :
2821
element(concat(aws_sns_topic.default.*.arn, list("")), 0)}"
22+
23+
aws_sns_topic_name = "${var.sns_topic == "" ?
24+
element(concat(aws_sns_topic.default_prefix.*.name, list("")), 0) :
25+
var.sns_topic}"
2926
}
3027

3128
resource "aws_sns_topic_policy" "default" {

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ output "sns_topic_arn" {
22
description = "The ARN of the SNS topic"
33
value = "${local.aws_sns_topic_arn}"
44
}
5+
6+
output "sns_topic_name" {
7+
description = "The SNS topic name"
8+
value = "${local.aws_sns_topic_name}"
9+
}

0 commit comments

Comments
 (0)