Skip to content

Commit

Permalink
Migrating sensor config to centralized module
Browse files Browse the repository at this point in the history
  • Loading branch information
thathaneydude committed Jun 24, 2024
1 parent d997643 commit 01ff41c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 104 deletions.
37 changes: 0 additions & 37 deletions data.tf

This file was deleted.

6 changes: 3 additions & 3 deletions load_balancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "azurerm_lb_backend_address_pool" "monitoring_pool" {
resource "azurerm_lb_probe" "sensor_health_check_probe" {
loadbalancer_id = azurerm_lb.scale_set_lb.id
name = var.lb_health_check_probe_name
port = 443
port = 41080
request_path = "/api/system/healthcheck/"
protocol = "Https"
interval_in_seconds = 30
Expand Down Expand Up @@ -62,8 +62,8 @@ resource "azurerm_lb_rule" "monitoring_health_check_rule" {
name = var.lb_health_check_rule_name
loadbalancer_id = azurerm_lb.scale_set_lb.id
protocol = "Tcp"
backend_port = 443
frontend_port = 443
backend_port = var.health_check_port
frontend_port = var.health_check_port
frontend_ip_configuration_name = azurerm_lb.scale_set_lb.frontend_ip_configuration[0].name
backend_address_pool_ids = [
azurerm_lb_backend_address_pool.management_pool.id
Expand Down
2 changes: 1 addition & 1 deletion scale_set.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "azurerm_linux_virtual_machine_scale_set" "sensor_scale_set" {
resource_group_name = var.resource_group_name
sku = var.virtual_machine_size
instances = 1
custom_data = var.enrichment_storage_account_name == "" ? data.cloudinit_config.config.rendered : data.cloudinit_config.config_with_enrichment.rendered
custom_data = module.sensor_config.cloudinit_config.rendered

source_image_id = var.corelight_sensor_image_id

Expand Down
16 changes: 16 additions & 0 deletions sensor_config.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module "sensor_config" {
source = "github.com/corelight/terraform-config-sensor"

fleet_community_string = var.community_string
sensor_license = var.license_key
sensor_management_interface_name = "eth0"
sensor_monitoring_interface_name = "eth1"
sensor_health_check_probe_source_ranges_cidr = azurerm_subnet.subnet.address_prefixes
sensor_health_check_http_port = var.health_check_port
gzip_config = true
base64_encode_config = true
enrichment_enabled = var.enrichment_storage_account_name != "" && var.enrichment_storage_container_name != ""
enrichment_cloud_provider_name = "azure"
enrichment_storage_account_name = var.enrichment_storage_account_name
enrichment_bucket_name = var.enrichment_storage_container_name
}
30 changes: 0 additions & 30 deletions templates/sensor_init.tpl

This file was deleted.

33 changes: 0 additions & 33 deletions templates/sensor_init_with_enrichment.tpl

This file was deleted.

6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ variable "lb_health_check_rule_name" {
default = "healthcheck-lb-rule"
}

variable "health_check_port" {
description = "the port number for the HTTP health check request"
type = string
default = "41080"
}

variable "lb_ssh_rule_name" {
description = "Name of the load balancer rule for SSH traffic"
type = string
Expand Down

0 comments on commit 01ff41c

Please sign in to comment.