-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch-template.tf
executable file
·49 lines (40 loc) · 1.46 KB
/
launch-template.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
resource "aws_launch_template" "worker_template" {
name = "${local.name_prefix}-worker-nodes-LT"
image_id = data.aws_ssm_parameter.eks_optimized_ami_id.value
key_name = var.ssh_key_name
placement {
availability_zone = "us-east-1c"
}
block_device_mappings {
device_name = "/dev/xvda"
ebs {
volume_size = 25
volume_type = "gp3"
}
}
tags = {
source = "Terraform"
Name = "${local.name_prefix}-worker-nodes-LT"
}
vpc_security_group_ids = ["${aws_security_group.nonmanaged_workers_sg[0].id}", module.bastion.security_group_id]
user_data = base64encode(templatefile("./scripts/userdata.sh.tpl", { CLUSTER_NAME = aws_eks_cluster.cluster[0].id, B64_CLUSTER_CA = aws_eks_cluster.cluster[0].certificate_authority[0].data, API_SERVER_URL = aws_eks_cluster.cluster[0].endpoint, RESTRICT_METADATA = var.spot_worker_restrict_metadata_access, NODE_LABEL = var.mn_node_label }))
depends_on = [
aws_iam_role_policy_attachment.cluster_AmazonEKSClusterPolicy,
aws_iam_role_policy_attachment.cluster_AmazonEKSServicePolicy,
aws_cloudwatch_log_group.cluster,
aws_eks_cluster.cluster,
aws_iam_role.managed_workers
]
}
#####
# Outputs
#####
output "eks_launch_template_id" {
value = data.aws_launch_template.worker_template.id
}
output "eks_launch_template_name" {
value = aws_launch_template.worker_template.name
}
output "eks_launch_template_ver" {
value = data.aws_launch_template.worker_template.latest_version
}