Skip to content

Commit

Permalink
feat: Allow snapshot_id to be specified for additional_ebs_volumes (t…
Browse files Browse the repository at this point in the history
  • Loading branch information
omjadas authored and Olesia Ivanenko committed Oct 12, 2021
1 parent 172f9cf commit 3c0ffcf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ locals {
service_linked_role_arn = "" # Arn of custom service linked role that Auto Scaling group will use. Useful when you have encrypted EBS
termination_policies = [] # A list of policies to decide how the instances in the auto scale group should be terminated.
platform = var.default_platform # Platform of workers. Either "linux" or "windows".
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
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
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.
warm_pool = null # If this block is configured, add a Warm Pool to the specified Auto Scaling group.
timeouts = {} # A map of timeouts for create/update/delete operations
snapshot_id = null # A custom snapshot ID.

# Settings for launch templates
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.
Expand Down
5 changes: 5 additions & 0 deletions workers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ resource "aws_launch_configuration" "workers" {
"encrypted",
local.workers_group_defaults["root_encrypted"],
)
snapshot_id = lookup(
block_device_mappings.value,
"snapshot_id",
local.workers_group_defaults["snapshot_id"],
)
delete_on_termination = lookup(ebs_block_device.value, "delete_on_termination", true)
}
}
Expand Down
5 changes: 5 additions & 0 deletions workers_launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ resource "aws_launch_template" "workers_launch_template" {
"kms_key_id",
local.workers_group_defaults["root_kms_key_id"],
)
snapshot_id = lookup(
block_device_mappings.value,
"snapshot_id",
local.workers_group_defaults["snapshot_id"],
)
delete_on_termination = lookup(block_device_mappings.value, "delete_on_termination", true)
}
}
Expand Down

0 comments on commit 3c0ffcf

Please sign in to comment.