Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
add additional outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpeteuil committed Jul 29, 2018
1 parent 795155b commit 825a9fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ resource "aws_cloudwatch_log_group" "sns_logged_item_group" {
retention_in_days = "${var.log_group_retention_days}"
}

# retrieve metadata for log group if no created, so arn can be included in outputs
data "aws_cloudwatch_log_group" "sns_logged_item_group" {
count = "${var.create_log_group ? 0 : 1}"
name = "${var.log_group_name}"
}

# -------------------------------------------------------------------------------------------------------------
# CLOUDWATCH LOG STREAM IF create_log_stream == true
# stream created in log_group specified or created
Expand Down
18 changes: 14 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# AWS SNS TO CLOUDWATCH LOGS LAMBDA GATEWAY - OUTPUTS
# -------------------------------------------------------------------------------------------------------------

output "lambda_func_name" {
output "lambda_name" {
description = "Name assigned to the Lambda Function."
value = "${var.lambda_func_name}"
}

output "lambda_func_arn" {
output "lambda_arn" {
description = "ARN of created Lambda Function."
value = "${aws_lambda_function.sns_cloudwatchlog.arn}"
}
Expand All @@ -17,12 +17,12 @@ output "lambda_endpoint" {
value = "${var.lambda_publish_func ? aws_lambda_function.sns_cloudwatchlog.qualified_arn : aws_lambda_function.sns_cloudwatchlog.arn}"
}

output "iam_role_id_lambda" {
output "lambda_iam_role_id" {
description = "Lambda IAM Role ID."
value = "${aws_iam_role.lambda_cloudwatch_logs.id}"
}

output "iam_role_arn_lambda" {
output "lambda_iam_role_arn" {
description = "Lambda IAM Role ARN."
value = "${aws_iam_role.lambda_cloudwatch_logs.arn}"
}
Expand All @@ -42,11 +42,21 @@ output "log_group_name" {
value = "${var.log_group_name}"
}

output "log_group_arn" {
description = "ARN of CloudWatch Log Group."
value = "${var.create_log_group ? join("", aws_cloudwatch_log_group.sns_logged_item_group.*.arn) : join("", data.aws_cloudwatch_log_group.sns_logged_item_group.*.arn)}"
}

output "log_stream_name" {
description = "Name of CloudWatch Log Stream."
value = "${var.log_stream_name}"
}

output "log_stream_arn" {
description = "Name of CloudWatch Log Stream."
value = "${var.create_sns_topic ? join("", aws_sns_topic.sns_log_topic.*.arn) : join("", data.aws_sns_topic.sns_log_topic.*.arn)}"
}

output "cloudwatch_event_rule_arn" {
description = "ARN of CloudWatch Trigger Event created to prevent hibernation."
value = "${join("", aws_cloudwatch_event_rule.warmer.*.arn)}"
Expand Down

0 comments on commit 825a9fd

Please sign in to comment.