Terraform Error:找到无效的点索引

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

我正在使用terraform版本0.11.8并尝试这个POC https://github.com/salizzar/terraform-aws-docker当我做terraform init它会抛出以下错误。我是新手使用terraform。谷歌搜索了很多,并尝试reffering terraform模块注册表来摆脱这个错误,但徒劳无功。

有人可以运行此POC并指出需要更改的内容吗?

https://github.com/salizzar/terraform-aws-docker/blob/master/main.tf

**ERROR :**

[root@localhost test]# terraform init
There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Error: Error loading /home/tottally/main.tf: Invalid dot index found: 'var.aws_security_group.sg_count'. Values in maps and lists can be referenced using square bracket indexing, like: 'var.mymap["key"]' or 'var.mylist[1]'. in:

${var.aws_security_group.sg_count}
terraform
1个回答
0
投票

我认为Terraform对这条线不满意:

count = "${var.aws_security_group.sg_count}"

不要使用这种双点表示法,尝试使用方括号索引,因为Terraform本身在错误消息中建议:

count = "${var.aws_security_group[sg_count]}"

顺便说一句,这个回购真的很旧,你可以在公共Terraform注册表中找到更好和最新的例子。

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