Manages an individual Autoscaling Group (ASG) tag. This resource should only be used in cases where ASGs are created outside Terraform (e.g., ASGs implicitly created by EKS Node Groups).
resource "aws_eks_node_group" "example" {
cluster_name = "example"
node_group_name = "example"
# ... other configuration ...
}
resource "aws_autoscaling_group_tag" "example" {
for_each = toset(
[for asg in flatten(
[for resources in aws_eks_node_group.example.resources : resources.autoscaling_groups]
) : asg.name]
)
autoscaling_group_name = each.value
tag {
key = "k8s.io/cluster-autoscaler/node-template/label/eks.amazonaws.com/capacityType"
value = "SPOT"
propagate_at_launch = false
}
}
This resource supports the following arguments:
autoscaling_group_name
- (Required) Name of the Autoscaling Group to apply the tag to.tag
- (Required) Tag to create. The tag
block is documented below.The tag
block supports the following arguments:
key
- (Required) Tag name.value
- (Required) Tag value.propagate_at_launch
- (Required) Whether to propagate the tags to instances launched by the ASG.This resource exports the following attributes in addition to the arguments above:
id
- ASG name and key, separated by a comma (,
)In Terraform v1.5.0 and later, use an import
block to import aws_autoscaling_group_tag
using the ASG name and key, separated by a comma (,
). For example:
import {
to = aws_autoscaling_group_tag.example
id = "asg-example,k8s.io/cluster-autoscaler/node-template/label/eks.amazonaws.com/capacityType"
}
Using terraform import
, import aws_autoscaling_group_tag
using the ASG name and key, separated by a comma (,
). For example:
% terraform import aws_autoscaling_group_tag.example asg-example,k8s.io/cluster-autoscaler/node-template/label/eks.amazonaws.com/capacityType