简体   繁体   English

Terraform:root_block_device 不支持 aws default_tag?

[英]Terraform: aws default_tag not supported in root_block_device?

I am trying to use the default_tag available for the aws terraform provider.我正在尝试使用 aws terraform 提供商可用的default_tag

Documentation:文档:

From the doc, it says:从文档中,它说:

This functionality is supported in all resources that implement tags, with the exception of the aws_autoscaling_group resource.

So, for all resources I have it works very well, except for aws_instance.root_block_device .因此,对于我拥有的所有资源,它工作得很好,除了aws_instance.root_block_device

For example, I have:例如,我有:

provider "aws" {
  [...]
  default_tags {
    tags = {
      Env = prod
    }
  }
}

resource "aws_instance" "instance" {
  ami           = xxx
  instance_type = xxx
  
  root_block_device {
    volume_size           = xxx
    volume_type           = xxx
  }
}

The default tag Env = prod is correctly added to the instance itself, but not for the root_device_block block.默认标记Env = prod已正确添加到实例本身,但不是用于root_device_block块。

So I'm wondering if default_tag is supported for this.所以我想知道是否支持default_tag It's true that the documentation says supported in all **resources** but root_block_device is only an argument of this resource, so maybe this is the problem?的确,文档说supported in all **resources**root_block_device只是该资源的一个参数,所以也许这就是问题所在?

I'm just looking for a kind of confirmation because the documentation is not very clear on this point.我只是在寻找一种确认,因为文档在这一点上不是很清楚。

Thank you谢谢

This is not supported yet.尚不支持此功能。 There are two issues are still open 1 2有两个问题仍然悬而未决1 2

but you can use this workaround solution但您可以使用此解决方法

data "aws_default_tags" "example" {}
aws_instance {
  volume_tags = merge(aws_default_tags.example.default_tags, var.extra_tags)
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 terraform 在 EC2 实例中选择性地配置 root_block_device - How to optionally configure root_block_device in EC2 instance using terraform 如何识别terraform创建的aws ebs block卷名称和实际设备名称(rhel)之间的映射? - How to identify the mapping between aws ebs block volume name and the actual device name(rhel) created via terraform? Terraform 与 aws 到 select ami 基于标签与排序 - Terraform with aws to select ami based on tag with sort 如何为 AWS DocumentDB 中的组替换 $$ROOT - 不支持的功能:$$ROOT - How to replace $$ROOT for group in AWS DocumentDB - Feature not supported: $$ROOT 使用动态块通过 Terraform 引用 AWS 中的安全组 - Referencing Security Group in AWS via Terraform using Dynamic Block 如何在 Terraform 中通过标签获取所有 AWS Lambda - How can I get all AWS Lambdas by Tag in Terraform 将 EC2 与默认 VPC 连接与 AWS 中的自定义 VPC Terraform - Connecting EC2 with Default VPC vs Customized VPC in AWS Terraform Terraform AWS 提供商:启动源实例时出错:不支持:当前不支持请求的配置 - Terraform AWS provider : Error launching source instance: Unsupported: The requested configuration is currently not supported Terraform 部署 EC2 实例时有条件的动态 ebs_block_device - Terraform conditional dynamic ebs_block_device while deploying EC2 instances 在 AWS 上设置 Terraform - Setting Up Terraform on AWS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM