mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-18 01:27:55 +01:00
feat: Support default_tags in aws_autoscaling_group (#1973)
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
provider "aws" {
|
||||
region = local.region
|
||||
|
||||
default_tags {
|
||||
tags = {
|
||||
ExampleDefaultTag = "ExampleDefaultValue"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
@@ -216,6 +222,8 @@ module "self_managed_node_group" {
|
||||
module.eks.cluster_security_group_id,
|
||||
]
|
||||
|
||||
use_default_tags = true
|
||||
|
||||
tags = merge(local.tags, { Separate = "self-managed-node-group" })
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ module "self_managed_node_group" {
|
||||
| [aws_security_group_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
|
||||
| [aws_ami.eks_default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source |
|
||||
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
|
||||
| [aws_default_tags.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/default_tags) | data source |
|
||||
| [aws_iam_policy_document.assume_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
|
||||
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
|
||||
|
||||
@@ -161,6 +162,7 @@ module "self_managed_node_group" {
|
||||
| <a name="input_target_group_arns"></a> [target\_group\_arns](#input\_target\_group\_arns) | A set of `aws_alb_target_group` ARNs, for use with Application or Network Load Balancing | `list(string)` | `[]` | no |
|
||||
| <a name="input_termination_policies"></a> [termination\_policies](#input\_termination\_policies) | A list of policies to decide how the instances in the Auto Scaling Group should be terminated. The allowed values are `OldestInstance`, `NewestInstance`, `OldestLaunchConfiguration`, `ClosestToNextInstanceHour`, `OldestLaunchTemplate`, `AllocationStrategy`, `Default` | `list(string)` | `null` | no |
|
||||
| <a name="input_update_launch_template_default_version"></a> [update\_launch\_template\_default\_version](#input\_update\_launch\_template\_default\_version) | Whether to update Default Version each update. Conflicts with `launch_template_default_version` | `bool` | `true` | no |
|
||||
| <a name="input_use_default_tags"></a> [use\_default\_tags](#input\_use\_default\_tags) | Enables/disables the use of provider default tags in the tag\_specifications of the Auto Scaling group | `bool` | `false` | no |
|
||||
| <a name="input_use_mixed_instances_policy"></a> [use\_mixed\_instances\_policy](#input\_use\_mixed\_instances\_policy) | Determines whether to use a mixed instances policy in the autoscaling group or not | `bool` | `false` | no |
|
||||
| <a name="input_use_name_prefix"></a> [use\_name\_prefix](#input\_use\_name\_prefix) | Determines whether to use `name` as is or create a unique name beginning with the `name` as the prefix | `bool` | `true` | no |
|
||||
| <a name="input_user_data_template_path"></a> [user\_data\_template\_path](#input\_user\_data\_template\_path) | Path to a local, custom user data template file to use when rendering user data | `string` | `""` | no |
|
||||
|
||||
@@ -2,6 +2,8 @@ data "aws_partition" "current" {}
|
||||
|
||||
data "aws_caller_identity" "current" {}
|
||||
|
||||
data "aws_default_tags" "current" {}
|
||||
|
||||
data "aws_ami" "eks_default" {
|
||||
count = var.create ? 1 : 0
|
||||
|
||||
@@ -385,7 +387,7 @@ resource "aws_autoscaling_group" "this" {
|
||||
"kubernetes.io/cluster/${var.cluster_name}" = "owned"
|
||||
"k8s.io/cluster/${var.cluster_name}" = "owned"
|
||||
},
|
||||
var.tags,
|
||||
var.use_default_tags ? merge(data.aws_default_tags.current.tags, var.tags) : var.tags
|
||||
)
|
||||
|
||||
content {
|
||||
|
||||
@@ -452,6 +452,12 @@ variable "delete_timeout" {
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "use_default_tags" {
|
||||
description = "Enables/disables the use of provider default tags in the tag_specifications of the Auto Scaling group"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Autoscaling group schedule
|
||||
################################################################################
|
||||
|
||||
@@ -381,7 +381,8 @@ module "self_managed_node_group" {
|
||||
create_schedule = try(each.value.create_schedule, var.self_managed_node_group_defaults.create_schedule, false)
|
||||
schedules = try(each.value.schedules, var.self_managed_node_group_defaults.schedules, null)
|
||||
|
||||
delete_timeout = try(each.value.delete_timeout, var.self_managed_node_group_defaults.delete_timeout, null)
|
||||
delete_timeout = try(each.value.delete_timeout, var.self_managed_node_group_defaults.delete_timeout, null)
|
||||
use_default_tags = try(each.value.use_default_tags, var.self_managed_node_group_defaults.use_default_tags, false)
|
||||
|
||||
# User data
|
||||
platform = try(each.value.platform, var.self_managed_node_group_defaults.platform, "linux")
|
||||
|
||||
Reference in New Issue
Block a user