Migrate AWS launch configurations to launch templates
* Same features, but AWS will soon require launch templates * Starting Dec 31, 2022 AWS will not add new instance types (e.g. graviton 4) to launch configuration support Rel: https://aws.amazon.com/blogs/compute/amazon-ec2-auto-scaling-will-no-longer-add-support-for-new-ec2-features-to-launch-configurations/
This commit is contained in:
parent
f0e5982b3c
commit
da76d32aba
|
@ -8,6 +8,11 @@ Notable changes between versions.
|
||||||
* Update Cilium from v1.12.3 to [v1.12.4](https://github.com/cilium/cilium/releases/tag/v1.12.4)
|
* Update Cilium from v1.12.3 to [v1.12.4](https://github.com/cilium/cilium/releases/tag/v1.12.4)
|
||||||
* Update flannel from v0.15.1 to [v0.20.1](https://github.com/flannel-io/flannel/releases/tag/v0.20.1)
|
* Update flannel from v0.15.1 to [v0.20.1](https://github.com/flannel-io/flannel/releases/tag/v0.20.1)
|
||||||
|
|
||||||
|
### AWS
|
||||||
|
|
||||||
|
* Migrate AWS launch configurations to launch templates
|
||||||
|
* Starting Dec 31, 2022 AWS won't add new instance types/families to launch configurations
|
||||||
|
|
||||||
### Addons
|
### Addons
|
||||||
|
|
||||||
* Update Prometheus from v2.40.1 to [v2.40.2](https://github.com/prometheus/prometheus/releases/tag/v2.40.2)
|
* Update Prometheus from v2.40.1 to [v2.40.2](https://github.com/prometheus/prometheus/releases/tag/v2.40.2)
|
||||||
|
|
|
@ -31,6 +31,7 @@ resource "aws_instance" "controllers" {
|
||||||
volume_size = var.disk_size
|
volume_size = var.disk_size
|
||||||
iops = var.disk_iops
|
iops = var.disk_iops
|
||||||
encrypted = true
|
encrypted = true
|
||||||
|
tags = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
|
|
|
@ -13,7 +13,10 @@ resource "aws_autoscaling_group" "workers" {
|
||||||
vpc_zone_identifier = var.subnet_ids
|
vpc_zone_identifier = var.subnet_ids
|
||||||
|
|
||||||
# template
|
# template
|
||||||
launch_configuration = aws_launch_configuration.worker.name
|
launch_template {
|
||||||
|
id = aws_launch_template.worker.id
|
||||||
|
version = aws_launch_template.worker.latest_version
|
||||||
|
}
|
||||||
|
|
||||||
# target groups to which instances should be added
|
# target groups to which instances should be added
|
||||||
target_group_arns = flatten([
|
target_group_arns = flatten([
|
||||||
|
@ -49,25 +52,42 @@ resource "aws_autoscaling_group" "workers" {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Worker template
|
# Worker template
|
||||||
resource "aws_launch_configuration" "worker" {
|
resource "aws_launch_template" "worker" {
|
||||||
name_prefix = "${var.name}-worker"
|
name_prefix = "${var.name}-worker"
|
||||||
image_id = local.ami_id
|
image_id = local.ami_id
|
||||||
instance_type = var.instance_type
|
instance_type = var.instance_type
|
||||||
spot_price = var.spot_price > 0 ? var.spot_price : null
|
monitoring {
|
||||||
enable_monitoring = false
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
user_data = data.ct_config.worker.rendered
|
user_data = sensitive(base64encode(data.ct_config.worker.rendered))
|
||||||
|
|
||||||
# storage
|
# storage
|
||||||
root_block_device {
|
ebs_optimized = true
|
||||||
volume_type = var.disk_type
|
block_device_mappings {
|
||||||
volume_size = var.disk_size
|
device_name = "/dev/xvda"
|
||||||
iops = var.disk_iops
|
ebs {
|
||||||
encrypted = true
|
volume_type = var.disk_type
|
||||||
|
volume_size = var.disk_size
|
||||||
|
iops = var.disk_iops
|
||||||
|
encrypted = true
|
||||||
|
delete_on_termination = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
security_groups = var.security_groups
|
vpc_security_group_ids = var.security_groups
|
||||||
|
|
||||||
|
# spot
|
||||||
|
dynamic "instance_market_options" {
|
||||||
|
for_each = var.spot_price > 0 ? [1] : []
|
||||||
|
content {
|
||||||
|
market_type = "spot"
|
||||||
|
spot_options {
|
||||||
|
max_price = var.spot_price
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
// Override the default destroy and replace update behavior
|
// Override the default destroy and replace update behavior
|
||||||
|
|
|
@ -32,6 +32,7 @@ resource "aws_instance" "controllers" {
|
||||||
volume_size = var.disk_size
|
volume_size = var.disk_size
|
||||||
iops = var.disk_iops
|
iops = var.disk_iops
|
||||||
encrypted = true
|
encrypted = true
|
||||||
|
tags = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
|
|
|
@ -13,7 +13,10 @@ resource "aws_autoscaling_group" "workers" {
|
||||||
vpc_zone_identifier = var.subnet_ids
|
vpc_zone_identifier = var.subnet_ids
|
||||||
|
|
||||||
# template
|
# template
|
||||||
launch_configuration = aws_launch_configuration.worker.name
|
launch_template {
|
||||||
|
id = aws_launch_template.worker.id
|
||||||
|
version = aws_launch_template.worker.latest_version
|
||||||
|
}
|
||||||
|
|
||||||
# target groups to which instances should be added
|
# target groups to which instances should be added
|
||||||
target_group_arns = flatten([
|
target_group_arns = flatten([
|
||||||
|
@ -49,25 +52,42 @@ resource "aws_autoscaling_group" "workers" {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Worker template
|
# Worker template
|
||||||
resource "aws_launch_configuration" "worker" {
|
resource "aws_launch_template" "worker" {
|
||||||
name_prefix = "${var.name}-worker"
|
name_prefix = "${var.name}-worker"
|
||||||
image_id = local.ami_id
|
image_id = local.ami_id
|
||||||
instance_type = var.instance_type
|
instance_type = var.instance_type
|
||||||
spot_price = var.spot_price > 0 ? var.spot_price : null
|
monitoring {
|
||||||
enable_monitoring = false
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
user_data = data.ct_config.worker.rendered
|
user_data = sensitive(base64encode(data.ct_config.worker.rendered))
|
||||||
|
|
||||||
# storage
|
# storage
|
||||||
root_block_device {
|
ebs_optimized = true
|
||||||
volume_type = var.disk_type
|
block_device_mappings {
|
||||||
volume_size = var.disk_size
|
device_name = "/dev/xvda"
|
||||||
iops = var.disk_iops
|
ebs {
|
||||||
encrypted = true
|
volume_type = var.disk_type
|
||||||
|
volume_size = var.disk_size
|
||||||
|
iops = var.disk_iops
|
||||||
|
encrypted = true
|
||||||
|
delete_on_termination = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
security_groups = var.security_groups
|
vpc_security_group_ids = var.security_groups
|
||||||
|
|
||||||
|
# spot
|
||||||
|
dynamic "instance_market_options" {
|
||||||
|
for_each = var.spot_price > 0 ? [1] : []
|
||||||
|
content {
|
||||||
|
market_type = "spot"
|
||||||
|
spot_options {
|
||||||
|
max_price = var.spot_price
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
// Override the default destroy and replace update behavior
|
// Override the default destroy and replace update behavior
|
||||||
|
|
Loading…
Reference in New Issue