Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
feat: add module_version_monitoring_enabled var
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwittig committed Apr 27, 2023
1 parent 44edb03 commit 8de5830
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ JSON

resource "aws_cloudwatch_event_rule" "monitoring_jump_start_connection" {
depends_on = [aws_sns_topic_subscription.marbot]
count = local.enabled ? 1 : 0
count = (var.module_version_monitoring_enabled && local.enabled) ? 1 : 0

name = "marbot-ec2-instance-connection-${random_id.id8.hex}"
description = "Monitoring Jump Start connection. (created by marbot)"
Expand All @@ -160,7 +160,7 @@ resource "aws_cloudwatch_event_rule" "monitoring_jump_start_connection" {
}

resource "aws_cloudwatch_event_target" "monitoring_jump_start_connection" {
count = local.enabled ? 1 : 0
count = (var.module_version_monitoring_enabled && local.enabled) ? 1 : 0

rule = join("", aws_cloudwatch_event_rule.monitoring_jump_start_connection.*.name)
target_id = "marbot"
Expand All @@ -169,7 +169,7 @@ resource "aws_cloudwatch_event_target" "monitoring_jump_start_connection" {
{
"Type": "monitoring-jump-start-tf-connection",
"Module": "ec2-instance",
"Version": "1.0.0",
"Version": "1.1.0",
"Partition": "${data.aws_partition.current.partition}",
"AccountId": "${data.aws_caller_identity.current.account_id}",
"Region": "${data.aws_region.current.name}"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ variable "enabled" {
default = true
}

variable "module_version_monitoring_enabled" {
type = bool
description = "Report the module version back to marbot to notify if updates are available."
default = true
}

variable "tags" {
description = "A map of tags to add to all resources"
type = map(string)
Expand Down

0 comments on commit 8de5830

Please sign in to comment.