如何为 aws_autoscaling_group 发出的现货请求应用标签?

How to apply tags for spot requests made by aws_autoscaling_group?

我使用 terraform 创建带有启动配置的 asg market_type=spot。 ASG 发出现货请求,但它没有标签。 实例具有来自 asg.

的标签

这似乎是 AWS 的限制。标签不会自动应用于 Spot 实例。您需要采用一种机制来捕获新实例 ID 并应用标签。这是官方文档

You can assign a tag to a Spot Instance request after you create it. The tags that you create for your Spot Instance requests only apply to the requests. These tags are not added automatically to the Spot Instance that the Spot service launches to fulfill the request. You must add tags to a Spot Instance yourself after the Spot Instance is launched.

Tagging Spot Instance Requests