You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

询问AWS Launch Template中tag_specifications的resource_type可选值

Terraform aws_launch_template中tag_specifications的resource_type可选值

除了你提供示例里的instance和volume,resource_type字段还支持以下取值:

  • network-interface:将标签应用到实例创建的弹性网络接口
  • spot-instances-request:将标签应用到Spot实例请求资源

这些取值对应AWS EC2启动模板在创建资源时会生成的关联对象,标签会被自动附加到指定类型的资源上。

你提供的示例代码整理如下:

resource "aws_launch_template" "foo" {
  name = "foo"

  block_device_mappings {
    device_name = "/dev/sda1"

    ebs {
      volume_size = 20
    }
  }

  image_id = "ami-test"
  instance_type = "t2.micro"
  key_name = "test"

  tag_specifications {
    resource_type = "instance"

    tags = {
      Name = "test"
    }
  }

  tag_specifications {
    resource_type = "volume"

    tags = {
      Name = "test"
    }
  }
}

内容的提问来源于stack exchange,提问作者Catalan Jarvis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 01:25:55