Skip to content

Commit 8866569

Browse files
authored
feat: Allow snapshot_id to be specified for additional_ebs_volumes (#1431)
1 parent f37e5af commit 8866569

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

locals.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ locals {
7878
service_linked_role_arn = "" # Arn of custom service linked role that Auto Scaling group will use. Useful when you have encrypted EBS
7979
termination_policies = [] # A list of policies to decide how the instances in the auto scale group should be terminated.
8080
platform = var.default_platform # Platform of workers. Either "linux" or "windows".
81-
additional_ebs_volumes = [] # A list of additional volumes to be attached to the instances on this Auto Scaling group. Each volume should be an object with the following: block_device_name (required), volume_size, volume_type, iops, throughput, encrypted, kms_key_id (only on launch-template), delete_on_termination. Optional values are grabbed from root volume or from defaults
81+
additional_ebs_volumes = [] # A list of additional volumes to be attached to the instances on this Auto Scaling group. Each volume should be an object with the following: block_device_name (required), volume_size, volume_type, iops, throughput, encrypted, kms_key_id (only on launch-template), delete_on_termination, snapshot_id. Optional values are grabbed from root volume or from defaults
8282
additional_instance_store_volumes = [] # A list of additional instance store (local disk) volumes to be attached to the instances on this Auto Scaling group. Each volume should be an object with the following: block_device_name (required), virtual_name.
8383
warm_pool = null # If this block is configured, add a Warm Pool to the specified Auto Scaling group.
8484
timeouts = {} # A map of timeouts for create/update/delete operations
85+
snapshot_id = null # A custom snapshot ID.
8586

8687
# Settings for launch templates
8788
root_block_device_name = concat(data.aws_ami.eks_worker.*.root_device_name, [""])[0] # Root device name for Linux workers. If not provided, will assume default Linux AMI was used.

workers.tf

+5
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ resource "aws_launch_configuration" "workers" {
344344
"encrypted",
345345
local.workers_group_defaults["root_encrypted"],
346346
)
347+
snapshot_id = lookup(
348+
block_device_mappings.value,
349+
"snapshot_id",
350+
local.workers_group_defaults["snapshot_id"],
351+
)
347352
delete_on_termination = lookup(ebs_block_device.value, "delete_on_termination", true)
348353
}
349354
}

workers_launch_template.tf

+5
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,11 @@ resource "aws_launch_template" "workers_launch_template" {
524524
"kms_key_id",
525525
local.workers_group_defaults["root_kms_key_id"],
526526
)
527+
snapshot_id = lookup(
528+
block_device_mappings.value,
529+
"snapshot_id",
530+
local.workers_group_defaults["snapshot_id"],
531+
)
527532
delete_on_termination = lookup(block_device_mappings.value, "delete_on_termination", true)
528533
}
529534
}

0 commit comments

Comments
 (0)