mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-18 09:38:33 +01:00
fix: Update autoscaling group tags -> tag to support v4 of AWS provider (#1866)
This commit is contained in:
@@ -54,11 +54,7 @@ module "eks" {
|
|||||||
triggers = ["tag"]
|
triggers = ["tag"]
|
||||||
}
|
}
|
||||||
|
|
||||||
propogate_tags = [{
|
tags = { "aws-node-termination-handler/managed" = "true" }
|
||||||
key = "aws-node-termination-handler/managed"
|
|
||||||
value = true
|
|
||||||
propagate_at_launch = true
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mixed_instance = {
|
mixed_instance = {
|
||||||
@@ -82,11 +78,7 @@ module "eks" {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
propogate_tags = [{
|
tags = { "aws-node-termination-handler/managed" = "true" }
|
||||||
key = "aws-node-termination-handler/managed"
|
|
||||||
value = true
|
|
||||||
propagate_at_launch = true
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spot = {
|
spot = {
|
||||||
@@ -96,12 +88,7 @@ module "eks" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'"
|
bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'"
|
||||||
|
tags = { "aws-node-termination-handler/managed" = "true" }
|
||||||
propogate_tags = [{
|
|
||||||
key = "aws-node-termination-handler/managed"
|
|
||||||
value = true
|
|
||||||
propagate_at_launch = true
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ module "self_managed_node_group" {
|
|||||||
| <a name="input_cluster_auth_base64"></a> [cluster\_auth\_base64](#input\_cluster\_auth\_base64) | Base64 encoded CA of associated EKS cluster | `string` | `""` | no |
|
| <a name="input_cluster_auth_base64"></a> [cluster\_auth\_base64](#input\_cluster\_auth\_base64) | Base64 encoded CA of associated EKS cluster | `string` | `""` | no |
|
||||||
| <a name="input_cluster_endpoint"></a> [cluster\_endpoint](#input\_cluster\_endpoint) | Endpoint of associated EKS cluster | `string` | `""` | no |
|
| <a name="input_cluster_endpoint"></a> [cluster\_endpoint](#input\_cluster\_endpoint) | Endpoint of associated EKS cluster | `string` | `""` | no |
|
||||||
| <a name="input_cluster_ip_family"></a> [cluster\_ip\_family](#input\_cluster\_ip\_family) | The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6` | `string` | `null` | no |
|
| <a name="input_cluster_ip_family"></a> [cluster\_ip\_family](#input\_cluster\_ip\_family) | The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6` | `string` | `null` | no |
|
||||||
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of associated EKS cluster | `string` | `null` | no |
|
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of associated EKS cluster | `string` | `""` | no |
|
||||||
| <a name="input_cluster_security_group_id"></a> [cluster\_security\_group\_id](#input\_cluster\_security\_group\_id) | Cluster control plane security group ID | `string` | `null` | no |
|
| <a name="input_cluster_security_group_id"></a> [cluster\_security\_group\_id](#input\_cluster\_security\_group\_id) | Cluster control plane security group ID | `string` | `null` | no |
|
||||||
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | Kubernetes cluster version - used to lookup default AMI ID if one is not provided | `string` | `null` | no |
|
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | Kubernetes cluster version - used to lookup default AMI ID if one is not provided | `string` | `null` | no |
|
||||||
| <a name="input_cpu_options"></a> [cpu\_options](#input\_cpu\_options) | The CPU options for the instance | `map(string)` | `null` | no |
|
| <a name="input_cpu_options"></a> [cpu\_options](#input\_cpu\_options) | The CPU options for the instance | `map(string)` | `null` | no |
|
||||||
@@ -146,7 +146,6 @@ module "self_managed_node_group" {
|
|||||||
| <a name="input_platform"></a> [platform](#input\_platform) | Identifies if the OS platform is `bottlerocket`, `linux`, or `windows` based | `string` | `"linux"` | no |
|
| <a name="input_platform"></a> [platform](#input\_platform) | Identifies if the OS platform is `bottlerocket`, `linux`, or `windows` based | `string` | `"linux"` | no |
|
||||||
| <a name="input_post_bootstrap_user_data"></a> [post\_bootstrap\_user\_data](#input\_post\_bootstrap\_user\_data) | User data that is appended to the user data script after of the EKS bootstrap script. Not used when `platform` = `bottlerocket` | `string` | `""` | no |
|
| <a name="input_post_bootstrap_user_data"></a> [post\_bootstrap\_user\_data](#input\_post\_bootstrap\_user\_data) | User data that is appended to the user data script after of the EKS bootstrap script. Not used when `platform` = `bottlerocket` | `string` | `""` | no |
|
||||||
| <a name="input_pre_bootstrap_user_data"></a> [pre\_bootstrap\_user\_data](#input\_pre\_bootstrap\_user\_data) | User data that is injected into the user data script ahead of the EKS bootstrap script. Not used when `platform` = `bottlerocket` | `string` | `""` | no |
|
| <a name="input_pre_bootstrap_user_data"></a> [pre\_bootstrap\_user\_data](#input\_pre\_bootstrap\_user\_data) | User data that is injected into the user data script ahead of the EKS bootstrap script. Not used when `platform` = `bottlerocket` | `string` | `""` | no |
|
||||||
| <a name="input_propagate_tags"></a> [propagate\_tags](#input\_propagate\_tags) | A list of tag blocks. Each element should have keys named `key`, `value`, and `propagate_at_launch` | `list(map(string))` | `[]` | no |
|
|
||||||
| <a name="input_protect_from_scale_in"></a> [protect\_from\_scale\_in](#input\_protect\_from\_scale\_in) | Allows setting instance protection. The autoscaling group will not select instances with this setting for termination during scale in events. | `bool` | `false` | no |
|
| <a name="input_protect_from_scale_in"></a> [protect\_from\_scale\_in](#input\_protect\_from\_scale\_in) | Allows setting instance protection. The autoscaling group will not select instances with this setting for termination during scale in events. | `bool` | `false` | no |
|
||||||
| <a name="input_ram_disk_id"></a> [ram\_disk\_id](#input\_ram\_disk\_id) | The ID of the ram disk | `string` | `null` | no |
|
| <a name="input_ram_disk_id"></a> [ram\_disk\_id](#input\_ram\_disk\_id) | The ID of the ram disk | `string` | `null` | no |
|
||||||
| <a name="input_schedules"></a> [schedules](#input\_schedules) | Map of autoscaling group schedule to create | `map(any)` | `{}` | no |
|
| <a name="input_schedules"></a> [schedules](#input\_schedules) | Map of autoscaling group schedule to create | `map(any)` | `{}` | no |
|
||||||
|
|||||||
@@ -378,6 +378,23 @@ resource "aws_autoscaling_group" "this" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamic "tag" {
|
||||||
|
for_each = merge(
|
||||||
|
{
|
||||||
|
"Name" = var.name
|
||||||
|
"kubernetes.io/cluster/${var.cluster_name}" = "owned"
|
||||||
|
"k8s.io/cluster/${var.cluster_name}" = "owned"
|
||||||
|
},
|
||||||
|
var.tags,
|
||||||
|
)
|
||||||
|
|
||||||
|
content {
|
||||||
|
key = tag.key
|
||||||
|
value = tag.value
|
||||||
|
propagate_at_launch = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
timeouts {
|
timeouts {
|
||||||
delete = var.delete_timeout
|
delete = var.delete_timeout
|
||||||
}
|
}
|
||||||
@@ -388,34 +405,6 @@ resource "aws_autoscaling_group" "this" {
|
|||||||
desired_capacity
|
desired_capacity
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
tags = concat(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
key = "Name"
|
|
||||||
value = var.name
|
|
||||||
propagate_at_launch = true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key = "kubernetes.io/cluster/${var.cluster_name}"
|
|
||||||
value = "owned"
|
|
||||||
propagate_at_launch = true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key = "k8s.io/cluster/${var.cluster_name}"
|
|
||||||
value = "owned"
|
|
||||||
propagate_at_launch = true
|
|
||||||
},
|
|
||||||
],
|
|
||||||
var.propagate_tags,
|
|
||||||
[for k, v in var.tags :
|
|
||||||
{
|
|
||||||
key = k
|
|
||||||
value = v
|
|
||||||
propagate_at_launch = true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ variable "platform" {
|
|||||||
variable "cluster_name" {
|
variable "cluster_name" {
|
||||||
description = "Name of associated EKS cluster"
|
description = "Name of associated EKS cluster"
|
||||||
type = string
|
type = string
|
||||||
default = null
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_endpoint" {
|
variable "cluster_endpoint" {
|
||||||
@@ -446,12 +446,6 @@ variable "delete_timeout" {
|
|||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "propagate_tags" {
|
|
||||||
description = "A list of tag blocks. Each element should have keys named `key`, `value`, and `propagate_at_launch`"
|
|
||||||
type = list(map(string))
|
|
||||||
default = []
|
|
||||||
}
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Autoscaling group schedule
|
# Autoscaling group schedule
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -450,6 +450,5 @@ module "self_managed_node_group" {
|
|||||||
security_group_rules = try(each.value.security_group_rules, var.self_managed_node_group_defaults.security_group_rules, {})
|
security_group_rules = try(each.value.security_group_rules, var.self_managed_node_group_defaults.security_group_rules, {})
|
||||||
security_group_tags = try(each.value.security_group_tags, var.self_managed_node_group_defaults.security_group_tags, {})
|
security_group_tags = try(each.value.security_group_tags, var.self_managed_node_group_defaults.security_group_tags, {})
|
||||||
|
|
||||||
tags = merge(var.tags, try(each.value.tags, var.self_managed_node_group_defaults.tags, {}))
|
tags = merge(var.tags, try(each.value.tags, var.self_managed_node_group_defaults.tags, {}))
|
||||||
propagate_tags = try(each.value.propagate_tags, var.self_managed_node_group_defaults.propagate_tags, [])
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user