【发布时间】:2019-09-18 10:32:36
【问题描述】:
我在 module/variables.tf 中配置了以下变量
variable "instance_name" {
type = string
default = "instance-1"
description = "Name of the instance."
}
我在同一个模块module/main.tf中引用变量如下
resource "google_compute_instance" "cloud_instance" {
name = var.instance_name
}
但是,当我运行 terraform init 时,我收到以下错误-
Error: Error parsing /module/main.tf: At 15:12: Unknown token: 15:12 IDENT var.instance_name
知道为什么会这样吗?
【问题讨论】:
-
您运行的是什么版本的 Terraform?如果它是 0.12 之前的版本(现在只是一个测试版),那么应该是
name = "${var.instance_name}"
标签: terraform terraform-provider-gcp