簡體   English   中英

Terraform:root_block_device 不支持 aws default_tag?

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

我正在嘗試使用 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只是該資源的一個參數,所以也許這就是問題所在?

我只是在尋找一種確認,因為文檔在這一點上不是很清楚。

謝謝

尚不支持此功能。 有兩個問題仍然懸而未決1 2

但您可以使用此解決方法

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM