-
Notifications
You must be signed in to change notification settings - Fork 2
/
launch_templates_spot.tf
91 lines (77 loc) · 2.32 KB
/
launch_templates_spot.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
resource "aws_launch_template" "lt_spot" {
count = var.is_spot_instance ? 1 : 0
name = "${module.generator.prefix}-${local.nodegroup_name}-spot-lt"
disable_api_termination = false
ebs_optimized = true
key_name = aws_key_pair.eks_node.key_name
user_data = filebase64("${path.module}/bootstrap/early-customizations/nvme-spot.sh")
block_device_mappings {
device_name = "/dev/xvda"
ebs {
volume_size = var.root_volume_size //default spot instance size
volume_type = "gp3"
throughput = "125"
delete_on_termination = true
encrypted = false
iops = 3000
}
}
# # we need to specify AZ, basause we have statefulsets and VPC.
placement {
availability_zone = local.nodegroup_az
}
metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
instance_metadata_tags = "enabled"
http_protocol_ipv6 = "disabled"
}
monitoring {
enabled = true
}
network_interfaces {
associate_public_ip_address = true
}
tag_specifications {
resource_type = "instance"
tags = merge(
{
"Name" = "${module.generator.prefix}-${local.nodegroup_name}-spot",
"Type" = "spot",
"nodeGroupName" = local.nodegroup_name
},
module.generator.common_tags
)
}
tag_specifications {
resource_type = "spot-instances-request"
tags = merge(
{
"Name" = "${module.generator.prefix}-${local.nodegroup_name}-spot",
"Type" = "spot",
"nodeGroupName" = local.nodegroup_name
},
module.generator.common_tags
)
}
tag_specifications {
resource_type = "volume"
tags = merge(
{
"Name" = "${module.generator.prefix}-${local.nodegroup_name}-spot",
"Type" = "spot",
"nodeGroupName" = local.nodegroup_name,
},
module.generator.common_tags
)
}
tags = merge(
{
"Name" = "${module.generator.prefix}-${local.nodegroup_name}-spot-lt"
"Type" = "spot"
"nodeGroupName" = local.nodegroup_name
},
module.generator.common_tags
)
}