Skip to content

Commit

Permalink
Migrating sensor config to centralized module (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
thathaneydude authored Jul 1, 2024
1 parent d997643 commit 18e722d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 105 deletions.
37 changes: 0 additions & 37 deletions data.tf

This file was deleted.

6 changes: 3 additions & 3 deletions 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 All @@ -31,8 +31,8 @@ resource "azurerm_linux_virtual_machine_scale_set" "sensor_scale_set" {
primary = true

ip_configuration {
primary = false
name = "management-nic-ip-cfg"
primary = true
subnet_id = azurerm_subnet.subnet.id
load_balancer_backend_address_pool_ids = [
azurerm_lb_backend_address_pool.management_pool.id
Expand All @@ -43,8 +43,8 @@ resource "azurerm_linux_virtual_machine_scale_set" "sensor_scale_set" {
network_interface {
name = "monitoring-nic"
ip_configuration {
primary = false
name = "monitoring-nic-ip-cfg"
primary = true
subnet_id = azurerm_subnet.subnet.id
load_balancer_backend_address_pool_ids = [
azurerm_lb_backend_address_pool.monitoring_pool.id
Expand Down
21 changes: 21 additions & 0 deletions sensor_config.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
locals {
# https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-custom-probe-overview#probe-source-ip-address
azure_lb_health_check_probe_ip = "168.63.129.16/32"
}

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 = [local.azure_lb_health_check_probe_ip]
sensor_health_check_http_port = 443
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.

2 changes: 0 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ variable "lb_ssh_rule_name" {
default = "management-ssh-lb-rule"
}



variable "tags" {
description = "Any tags that should be applied to resources deployed by the module"
type = object({})
Expand Down

0 comments on commit 18e722d

Please sign in to comment.