根中的变量未从模块填充

问题描述 投票:0回答:1

我的文件夹结构如下:

  • 数据.tf
  • 主.tf
  • 变量.tf
  • version.tf(声明 standard_tags 变量,没有默认值)
  • 状态初始化
    • 数据.tf
    • 主.tf
    • 变量.tf

'state_initialization'文件夹内的main.tf如下:

module "state_initialisation_tagging" {
 source = "../"
 standard_tags = data.terraform_remote_state.param_store_tags.outputs.standard_tags
 .. others...
}

同一文件夹中的 data.tf 具有以 s3 作为后端定义的数据资源。

但是当我在模块级别进行地形规划时,我收到以下错误消息。我缺少什么?我假设我不需要输出变量,因为模块 main.tf 中的 standard_tags = data.remote_state.xxx 正在处理这个问题。

The root module input variable "standard_tags" is not set, and has no default value. Use a -var or
│ -var-file command line argument to provide a value for this variable.
terraform terraform-provider-aws
1个回答
0
投票

我在根模块和子模块中都有“standard_tags”的变量定义。在我注释掉子模块中的那个之后它就起作用了。我们模板中的模块资源定义位于子模块中,因此有点混乱。将其更改为标准符号。

© www.soinside.com 2019 - 2024. All rights reserved.