From 608fccea386cfa883a3beccbaf707d881d1ea068 Mon Sep 17 00:00:00 2001 From: spengreb Date: Fri, 4 Feb 2022 16:49:49 +0100 Subject: [PATCH] Node exporter allowed by security group to monitoring.vereto.net --- main.tf | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index fa73710..7f3766c 100644 --- a/main.tf +++ b/main.tf @@ -15,7 +15,7 @@ resource "aws_instance" "jamulus" { ami = "${data.aws_ami.image.id}" instance_type = "c5.large" key_name = "jamulus" - security_groups = [ aws_security_group.ssh.name, aws_security_group.jamulus.name ] # Add your own IP to this group + security_groups = [ aws_security_group.ssh.name, aws_security_group.jamulus.name, aws_security_group.node-exporter.name ] # Add your own IP to this group provisioner "file" { source = "scripts/server-start.sh" @@ -44,7 +44,7 @@ resource "aws_instance" "jamulus" { } tags = { - Name = "jamulus-tester" + Name = "ejam.vereto.net" } } @@ -99,6 +99,20 @@ resource "aws_security_group_rule" "jamulus" { security_group_id = aws_security_group.jamulus.id } +resource "aws_security_group" "node-exporter" { + name = "node-exporter-port-access" + description = "Allow jamulus inbound traffic" +} + +resource "aws_security_group_rule" "node-exporter" { + type = "ingress" + to_port = 9100 + from_port = 9100 + protocol = "tcp" + cidr_blocks = [ "142.132.191.61/32"] + security_group_id = aws_security_group.node-exporter.id +} + output "instance_ip" { value = "${aws_instance.jamulus.public_ip}"