【问题标题】:Terraform code is not recognised environment variable (TF_VAR variable)无法识别 Terraform 代码的环境变量(TF_VAR 变量)
【发布时间】:2021-08-18 01:15:43
【问题描述】:

我想在 Terraform 中使用环境变量,但我的 TF 代码无法识别 TF_VAR。我设置为环境变量export TF_VAR_test="some value",并尝试在我的TF代码中使用tempval = var.test

使用 terraform v1.0.2

我在这里错过了什么?请给我提意见。谢谢。

【问题讨论】:

  • 你声明变量了吗?

标签: google-cloud-platform terraform


【解决方案1】:

在使用变量之前,必须declare the variable in a variable block

例如...

variable "test" {
  type = string
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-04
    相关资源
    最近更新 更多