-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathtemplate.tf
75 lines (60 loc) · 1.68 KB
/
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
63
64
65
66
67
68
69
70
71
72
73
74
75
resource "aws_launch_template" "k8s_server" {
name_prefix = "${var.common_prefix}-server-tpl-${var.environment}"
image_id = var.ami
instance_type = var.default_instance_type
user_data = data.template_cloudinit_config.k8s_server.rendered
lifecycle {
create_before_destroy = true
}
iam_instance_profile {
name = aws_iam_instance_profile.k8s_instance_profile.name
}
block_device_mappings {
device_name = "/dev/sda1"
ebs {
volume_size = 20
encrypted = true
}
}
key_name = var.ssk_key_pair_name
network_interfaces {
associate_public_ip_address = var.ec2_associate_public_ip_address
security_groups = [aws_security_group.k8s_sg.id]
}
tags = merge(
local.global_tags,
{
"Name" = lower("${var.common_prefix}-server-tpl-${var.environment}")
}
)
}
resource "aws_launch_template" "k8s_worker" {
name_prefix = "${var.common_prefix}-worker-tpl-${var.environment}"
image_id = var.ami
instance_type = var.default_instance_type
user_data = data.template_cloudinit_config.k8s_worker.rendered
lifecycle {
create_before_destroy = true
}
iam_instance_profile {
name = aws_iam_instance_profile.k8s_instance_profile.name
}
block_device_mappings {
device_name = "/dev/sda1"
ebs {
volume_size = 20
encrypted = true
}
}
key_name = var.ssk_key_pair_name
network_interfaces {
associate_public_ip_address = var.ec2_associate_public_ip_address
security_groups = [aws_security_group.k8s_sg.id]
}
tags = merge(
local.global_tags,
{
"Name" = lower("${var.common_prefix}-worker-tpl-${var.environment}")
}
)
}