【发布时间】:2021-06-27 09:05:06
【问题描述】:
我有这样的资源repo/dynamo/main.tf:
resource "aws_dynamodb_table" "infra_locks" {
name = "infra-locks"
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
}
我将上面的文件称为模块跟随github repo
Tf 文件,我参考上面的文件repo/example/main.tf:
provider "aws" {
region = var.region
}
module "dynamodb_table" {
source = "../dynamodb_table"
name = "my-table"
}
我有 terraform init 成功但运行时失败 terraform plan
Error: Unsupported argument
on main.tf line 14, in module "dynamodb_table":
14: name = "my-table"
An argument named "name" is not expected here.
我该如何解决这个问题? 提前谢谢
【问题讨论】:
-
嗯,这个模块是来自 github 还是来自
"../dynamodb_table"?当前您引用了一个本地模块,该模块是否有name变量? -
是的,我从本地使用它,我已经初始化成功
Initializing modules... - dynamo_table in ../dynamo Initializing the backend... Initializing provider plugins... - Reusing previous version of hashicorp/aws from the dependency lock file - Using previously-installed hashicorp/aws v3.34.0 Terraform has been successfully initialized! -
那么github链接就无关紧要了,问题是:你本地的
dynamodb_table有name变量吗?答案可能是:不会。 -
@luk2302 我已经在问题的开头展示了 dynamo/main.tf,它有 name 属性
-
那不是变量。
标签: terraform terraform-provider-aws