Skip to content

Commit 4e52730

Browse files
fix: add support for KMS key EBS volume encryption (closes #19) (#20)
1 parent 98cf5c2 commit 4e52730

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ module "sensor" {
4646
fleet_token = "<the pairing token from the Fleet UI>"
4747
fleet_url = "<the URL of the fleet instance from the Fleet UI>"
4848
fleet_server_sslname = "<the ssl name provided by Fleet>"
49+
50+
# optional KMS key, if set will encrpyt the EBS volumes launched by the auto scaler group
51+
kms_key_id = "<the ID of the KMS key used to encrypt the EBS volumes>"
4952
}
5053
5154

launch_template.tf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ resource "aws_launch_template" "sensor_launch_template" {
1414
}
1515
}
1616

17+
block_device_mappings {
18+
device_name = var.sensor_launch_template_volume_name
19+
20+
ebs {
21+
volume_size = var.sensor_launch_template_volume_size
22+
volume_type = "gp3"
23+
encrypted = var.kms_key_id == "" ? false : true
24+
kms_key_id = var.kms_key_id == "" ? null : var.kms_key_id
25+
delete_on_termination = true
26+
}
27+
}
28+
1729
network_interfaces {
1830
device_index = 0
1931
security_groups = [aws_security_group.monitoring.id]
@@ -23,4 +35,4 @@ resource "aws_launch_template" "sensor_launch_template" {
2335
user_data = module.sensor_config.cloudinit_config.rendered
2436

2537
tags = var.tags
26-
}
38+
}

variables.tf

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ variable "fleet_server_sslname" {
5050
description = "SSL hostname for the fleet server"
5151
}
5252

53+
variable "kms_key_id" {
54+
description = "The KMS key ID to be used for EBS volume encryption for the auto-scale group instances"
55+
type = string
56+
default = null
57+
}
58+
5359
variable "license_key" {
5460
description = "Your Corelight sensor license key. Optional if fleet_url is configured."
5561
sensitive = true
@@ -111,6 +117,18 @@ variable "sensor_launch_template_instance_type" {
111117
default = "c5.2xlarge"
112118
}
113119

120+
variable "sensor_launch_template_volume_name" {
121+
description = "The name of the volume for the sensor launch template"
122+
type = string
123+
default = "/dev/xvda"
124+
}
125+
126+
variable "sensor_launch_template_volume_size" {
127+
description = "The size of the volume for the sensor launch template"
128+
type = number
129+
default = 500
130+
}
131+
114132
variable "lb_health_check_target_group_name" {
115133
description = "The name of the health check target group which determines if the sensor in the ASG comes up and is ready to accept traffic"
116134
type = string
@@ -200,4 +218,3 @@ variable "fleet_no_proxy" {
200218
default = ""
201219
description = "(optional) hosts or domains to bypass the proxy for fleet traffic"
202220
}
203-

0 commit comments

Comments
 (0)