【问题标题】:Terraform: aws default_tag not supported in root_block_device?Terraform:root_block_device 不支持 aws default_tag?
【发布时间】:2023-01-19 04:27:43
【问题描述】:

我正在尝试使用可用于 aws terraform 提供程序的 default_tag

文档:

从文档中,它说:

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

因此,除了aws_instance.root_block_device,我拥有的所有资源都运行良好。

例如,我有:

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
  }
}

默认标记Env = prod 已正确添加到实例本身,但不是root_device_block块。

所以我想知道是否支持default_tag。的确,文档说 supported in all **resources**root_block_device 只是一个争论这个资源,所以也许这就是问题所在?

我只是在寻找一种确认,因为文档在这一点上不是很清楚。

谢谢

【问题讨论】:

    标签: amazon-web-services terraform terraform-provider-aws


    【解决方案1】:

    这还不受支持。还有两个问题未解决1 2

    但您可以使用此解决方法

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-14
      • 2015-06-16
      • 2021-05-01
      • 2018-03-30
      相关资源
      最近更新 更多