-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows_launch_template.tf
62 lines (53 loc) · 2.1 KB
/
windows_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
50
51
52
53
54
55
56
57
58
59
60
61
62
resource "aws_iam_instance_profile" "windows-node-role" {
name = "windows-worker-node-Role"
role = "arn:aws:iam::1234567890:role/windows-worker-node-Role"
path = "/"
lifecycle { create_before_destroy = true }
}
data "aws_iam_instance_profile" "windows-instance-profile" {
name = "windows-worker-node-Role"
}
resource "aws_launch_template" "workers" {
name = "Windows_worker_nodes_launch_template-${var.cluster_name}"
image_id = data.aws_ssm_parameter.eks_worker_windows.id
#image_id = "ami-091e73687778fb295" #AmazonEKSoptimizedWindowsServer2019CoreAMI #"ami-031a195a9dcb6f78b" old one
instance_type = var.windows_node_instance_type
vpc_security_group_ids = var.eks_vpc_security_group_ids
key_name = "keypair-eks"
# Use the user_data
user_data = base64encode(data.template_file.userdata_windows.rendered)
monitoring {
enabled = true
}
block_device_mappings {
device_name = "/dev/sda1"
ebs {
volume_size = "50"
delete_on_termination = true
volume_type = "gp2"
}
}
tag_specifications {
resource_type = "instance"
tags = {
Name = "windows-node-${var.cluster_name}"
"kubernetes.io/cluster/${var.cluster_name}" = "owned"
"k8s.io/cluster-autoscaler/${var.cluster_name}" = "owned"
"k8s.io/cluster-autoscaler/enabled" = "true"
"eks:cluster-name" = var.cluster_name
}
}
tag_specifications {
resource_type = "volume"
tags = {
Name = "windows-workernode-volume-${var.cluster_name}"
}
}
iam_instance_profile {
name = data.aws_iam_instance_profile.windows-instance-profile.name
}
lifecycle {
create_before_destroy = true
}
depends_on = [kubernetes_deployment.vpc_admission_webhook_deployment, kubernetes_deployment.vpc_resource_controller, kubernetes_mutating_webhook_configuration.vpc_admission_webhook_cfg, null_resource.create-signed-cert]
}