|
@@ -1,6 +1,9 @@
|
|
# Some instance variables
|
|
# Some instance variables
|
|
locals {
|
|
locals {
|
|
instance_name_worker = "${var.prefix}-alsi-worker"
|
|
instance_name_worker = "${var.prefix}-alsi-worker"
|
|
|
|
+
|
|
|
|
+ splunk_vpc_cidrs = toset(concat([var.vpc_cidr], local.cidr_map["vpc-private-services"]))
|
|
|
|
+ data_sources = toset(concat(tolist(local.splunk_vpc_cidrs), local.splunk_data_sources))
|
|
}
|
|
}
|
|
|
|
|
|
resource "aws_network_interface" "worker" {
|
|
resource "aws_network_interface" "worker" {
|
|
@@ -34,7 +37,7 @@ resource "aws_instance" "worker" {
|
|
http_endpoint = "enabled"
|
|
http_endpoint = "enabled"
|
|
# checkov:skip=CKV_AWS_79:see tfsec explanation
|
|
# checkov:skip=CKV_AWS_79:see tfsec explanation
|
|
# tfsec:ignore:aws-ec2-enforce-http-token-imds Saltstack doesn't use s3 sources appropriately; see https://github.com/saltstack/salt/issues/60668
|
|
# tfsec:ignore:aws-ec2-enforce-http-token-imds Saltstack doesn't use s3 sources appropriately; see https://github.com/saltstack/salt/issues/60668
|
|
- http_tokens = "optional"
|
|
|
|
|
|
+ http_tokens = "optional"
|
|
}
|
|
}
|
|
|
|
|
|
ami = local.ami_map[local.ami_selection]
|
|
ami = local.ami_map[local.ami_selection]
|
|
@@ -163,7 +166,7 @@ resource "aws_security_group_rule" "alsi_worker_alb_elastic2" {
|
|
# TODO: Repeat top 2 for HEC and S2S forwarders
|
|
# TODO: Repeat top 2 for HEC and S2S forwarders
|
|
|
|
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in1" {
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in1" {
|
|
- description = "Web access"
|
|
|
|
|
|
+ description = "Web access from VPN"
|
|
type = "ingress"
|
|
type = "ingress"
|
|
from_port = 9000
|
|
from_port = 9000
|
|
to_port = 9000
|
|
to_port = 9000
|
|
@@ -172,7 +175,7 @@ resource "aws_security_group_rule" "alsi_worker_vpn_in1" {
|
|
security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
}
|
|
}
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in2" {
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in2" {
|
|
- description = "Web access"
|
|
|
|
|
|
+ description = "Web access from VPN"
|
|
type = "ingress"
|
|
type = "ingress"
|
|
from_port = 9200
|
|
from_port = 9200
|
|
to_port = 9200
|
|
to_port = 9200
|
|
@@ -181,7 +184,7 @@ resource "aws_security_group_rule" "alsi_worker_vpn_in2" {
|
|
security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
}
|
|
}
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in3" {
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in3" {
|
|
- description = "Test Splunk access"
|
|
|
|
|
|
+ description = "Splunk access from VPN"
|
|
type = "ingress"
|
|
type = "ingress"
|
|
from_port = 9997
|
|
from_port = 9997
|
|
to_port = 9998
|
|
to_port = 9998
|
|
@@ -190,7 +193,7 @@ resource "aws_security_group_rule" "alsi_worker_vpn_in3" {
|
|
security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
}
|
|
}
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in4" {
|
|
resource "aws_security_group_rule" "alsi_worker_vpn_in4" {
|
|
- description = "Test HEC access"
|
|
|
|
|
|
+ description = "HEC access from VPN"
|
|
type = "ingress"
|
|
type = "ingress"
|
|
from_port = 8088
|
|
from_port = 8088
|
|
to_port = 8088
|
|
to_port = 8088
|
|
@@ -200,14 +203,23 @@ resource "aws_security_group_rule" "alsi_worker_vpn_in4" {
|
|
}
|
|
}
|
|
resource "aws_security_group_rule" "alsi_worker_external_in" {
|
|
resource "aws_security_group_rule" "alsi_worker_external_in" {
|
|
# NLB requires the security group to allow access
|
|
# NLB requires the security group to allow access
|
|
- description = "Test Splunk access"
|
|
|
|
|
|
+ description = "Splunk access via NLB"
|
|
count = local.alsi_splunk_nlb ? 1 : 0
|
|
count = local.alsi_splunk_nlb ? 1 : 0
|
|
type = "ingress"
|
|
type = "ingress"
|
|
from_port = 9997
|
|
from_port = 9997
|
|
to_port = 9998
|
|
to_port = 9998
|
|
protocol = "tcp"
|
|
protocol = "tcp"
|
|
- cidr_blocks = toset(concat(local.cidr_map["vpc-access"], local.trusted_ips, local.splunk_data_sources))
|
|
|
|
- security_group_id = aws_security_group.alsi-alb-hec-sg.id
|
|
|
|
|
|
+ cidr_blocks = local.data_sources
|
|
|
|
+ security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
|
|
+}
|
|
|
|
+resource "aws_security_group_rule" "alsi_worker_hec_in" {
|
|
|
|
+ description = "HEC access from Customer"
|
|
|
|
+ type = "ingress"
|
|
|
|
+ from_port = 8088
|
|
|
|
+ to_port = 8088
|
|
|
|
+ protocol = "tcp"
|
|
|
|
+ cidr_blocks = local.data_sources
|
|
|
|
+ security_group_id = aws_security_group.alsi_worker_security_group.id
|
|
}
|
|
}
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
#----------------------------------------------------------------------------
|