Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Variables 如何在Terraform中的模块内加载局部变量?_Variables_Terraform - Fatal编程技术网

Variables 如何在Terraform中的模块内加载局部变量?

Variables 如何在Terraform中的模块内加载局部变量?,variables,terraform,Variables,Terraform,我有一个locals.tf文件,其中包含: locals { labels = { mockup = "duration is set 555" } } 还有一个名为“TEST”的模块,我在其中定义了一个GCP bucket资源: resource "google_storage_bucket" "my_bucket_2" { ... labels = var.labels_bucket } 我在测

我有一个locals.tf文件,其中包含:

locals {
  labels = {
    mockup  = "duration is set 555"
  }
}
还有一个名为“TEST”的模块,我在其中定义了一个GCP bucket资源:

resource "google_storage_bucket" "my_bucket_2" {
    ...
    labels = var.labels_bucket
}
我在测试模块中还有一个variables.tf文件:

variable "labels_bucket" {}
在main.tf文件中,我加载了如下模块:

module "test" {
  source = "./TEST"
  labels_bucket = local.labels
}
我希望变量得到本地变量的值,但在模块内部得到了以下错误:

googleapi:错误400:参数无效,无效

如何映射这些值


谢谢大家!

很简单,因为这是地图的价值问题。与地形无关。

谢谢你,现在你给我看的很明显。我深陷其中以至于忽略了它。