feat: Allow snapshot_id to be specified for additional_ebs_volumes#1431
Conversation
|
@antonbabenko @daroga0002 would it be possible to get a review for this PR? |
I will look into this, do you maybe have a example of module configuration which I can use for testing? |
Sure thing, the following works to illustrate its use (we use a similar config in order to decrease pod start times on fresh nodes).
# main.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.37"
}
}
required_version = "~> 1.0"
}
provider "aws" {
region = local.region
}
locals {
region = "us-west-2"
k8s_version = "1.21"
}
data "aws_vpc" "default" {
default = true
}
data "aws_subnet_ids" "default" {
vpc_id = data.aws_vpc.default.id
}
module "eks" {
source = "github.com/omjadas/terraform-aws-eks?ref=feat%2Fsnapshot_id"
create_eks = true
cluster_name = "test-cluster"
cluster_version = local.k8s_version
vpc_id = data.aws_vpc.default.id
subnets = data.aws_subnet_ids.default.ids
manage_aws_auth = false
enable_irsa = false
write_kubeconfig = false
worker_ami_name_filter = "bottlerocket-aws-k8s-${local.k8s_version}-x86_64-v*"
worker_groups_launch_template = [
{
name = "nodes"
asg_min_size = 1
asg_max_size = 1
asg_desired_capacity = 1
default_cooldown = 60
instance_type = "t3a.medium"
protect_from_scale_in = false
public_ip = true
userdata_template_file = "${path.module}/userdata.toml.tpl"
root_encrypted = true
root_volume_type = "gp3"
additional_ebs_volumes = [
{
block_device_name = "/dev/xvdb"
encrypted = true
volume_size = 50
volume_type = "gp3"
# snapshot_id = "<<snapshot id here>>"
}
]
}
]
}
# userdata.toml.tpl
[settings.kubernetes]
api-server = "${endpoint}"
cluster-certificate ="${cluster_auth_base64}"
cluster-name = "${cluster_name}" |
There was a problem hiding this comment.
I have tested and is working nice so can be merged 🚀
@omjadas thank you for contribution
@antonbabenko this can be merged, I have 3 more PRs to test and then we can make consolidated release
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
PR o'clock
Description
Allow additional ebs volumes to be created from snapshots.
Checklist