Terraform docker_集装箱标签不起作用?

Terraform docker_集装箱标签不起作用?,docker,terraform,Docker,Terraform,我正在尝试使用terraform向docker容器添加标签。他们说要使用“标签”。我试过: resource "docker_container" "my_test" { image = "ubuntu:latest" name = "my_test" labels { first = "label 1" another = "label 2" } } 但我明白了 Error: Unsupported block type on dock.tf line

我正在尝试使用terraform向docker容器添加标签。他们说要使用“标签”。我试过:

resource "docker_container" "my_test" {
  image = "ubuntu:latest"
  name = "my_test"
  labels {
    first = "label 1"
    another = "label 2"
  }
}
但我明白了

Error: Unsupported block type

  on dock.tf line 4, in resource "docker_container" "my_test":
   4:   labels {

Blocks of type "labels" are not expected here. Did you mean to define argument
"labels"? If so, use the equals sign to assign it a value.
我使用的是TerraformV0.12.9+provider.docker v2.3.0


知道我做错了什么吗?

看起来
标签在本例中是一个属性。设置这些块的语法在Terraform 0.12.x中发生了更改

您链接的资源引用仍显示0.12.x之前的方法。通过图像属性引用docker\u图像资源的方式可以看出:
image=“${docker\u image.ubuntu.latest}”

注意
标签={

resource "docker_container" "my_test" {
  image = "ubuntu:latest"
  name = "my_test"
  labels = {
    first = "label 1"
    another = "label 2"
  }
}

Ref:

看起来
标签
是此实例中的一个属性。在Terraform 0.12.x中设置这些块的语法已更改

您链接的资源引用仍然显示0.12.x之前的方法。通过图像属性引用docker\u图像资源的方式可以看出:
image=“${docker\u image.ubuntu.latest}”

注意
标签={

resource "docker_container" "my_test" {
  image = "ubuntu:latest"
  name = "my_test"
  labels = {
    first = "label 1"
    another = "label 2"
  }
}
参考: