feat: Allow snapshot_id to be specified for additional_ebs_volumes (#1431)

This commit is contained in:
omjadas
2021-10-07 23:26:53 +11:00
committed by GitHub
parent f37e5af88a
commit 8866569d53
3 changed files with 12 additions and 1 deletions

View File

@@ -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 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. 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". 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. 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. 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 timeouts = {} # A map of timeouts for create/update/delete operations
snapshot_id = null # A custom snapshot ID.
# Settings for launch templates # 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. 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.

View File

@@ -344,6 +344,11 @@ resource "aws_launch_configuration" "workers" {
"encrypted", "encrypted",
local.workers_group_defaults["root_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) delete_on_termination = lookup(ebs_block_device.value, "delete_on_termination", true)
} }
} }

View File

@@ -524,6 +524,11 @@ resource "aws_launch_template" "workers_launch_template" {
"kms_key_id", "kms_key_id",
local.workers_group_defaults["root_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) delete_on_termination = lookup(block_device_mappings.value, "delete_on_termination", true)
} }
} }