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

Commit 8de5830

Browse files
committed
feat: add module_version_monitoring_enabled var
1 parent 44edb03 commit 8de5830

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ JSON
151151

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

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

162162
resource "aws_cloudwatch_event_target" "monitoring_jump_start_connection" {
163-
count = local.enabled ? 1 : 0
163+
count = (var.module_version_monitoring_enabled && local.enabled) ? 1 : 0
164164

165165
rule = join("", aws_cloudwatch_event_rule.monitoring_jump_start_connection.*.name)
166166
target_id = "marbot"
@@ -169,7 +169,7 @@ resource "aws_cloudwatch_event_target" "monitoring_jump_start_connection" {
169169
{
170170
"Type": "monitoring-jump-start-tf-connection",
171171
"Module": "ec2-instance",
172-
"Version": "1.0.0",
172+
"Version": "1.1.0",
173173
"Partition": "${data.aws_partition.current.partition}",
174174
"AccountId": "${data.aws_caller_identity.current.account_id}",
175175
"Region": "${data.aws_region.current.name}"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ variable "enabled" {
2828
default = true
2929
}
3030

31+
variable "module_version_monitoring_enabled" {
32+
type = bool
33+
description = "Report the module version back to marbot to notify if updates are available."
34+
default = true
35+
}
36+
3137
variable "tags" {
3238
description = "A map of tags to add to all resources"
3339
type = map(string)

0 commit comments

Comments
 (0)