【发布时间】:2022-01-27 03:56:29
【问题描述】:
我有以下结构
main.tf
modules
--moduleA
----worker.tf
----variables.tf
main.tf 的内容:
module "moduleA" {
source = "./modules/moduleA"
}
variables.tf 的内容:
variable "num_of_workers" {
type = number
description = "This is number of workers"
default = 1
我想共同打电话terraform apply var="num_of_workers=12"
我收到一个错误:
Error: Value for undeclared variable
│ A variable named "num_of_workers" was assigned on the command line, but the root module does not declare a variable of that name. To use this value, add a "variable" block to the configuration.
有没有办法在模块的 variables.tf 中设置变量并从命令行设置它们?我在这里缺少什么?
【问题讨论】:
标签: terraform terraform-provider-azure