这是来自main.tf的aws_elb的代码块。
resource "aws_elb" "terraformelb" {
name = "terraformelb"
subnets = ["${aws_subnet.public_subnet.id}"]
security_groups = ["${aws_security_group.web_sg.id}"]
instances = ["${aws_instance.web_*.id}"]
listener {
instance_port = 80
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
}
我遵循了terraform语法,但我仍然收到错误
Failed to load root config module: Error loading C:\Users\snadella001\Downloads\Terraform\repo\main.tf: Error reading config for aws_elb[terraform-elb]: parse error at 1:21: expected expression but found "."
答案 0 :(得分:0)
错误消息是资源terraform-elb
(名称中的减号)
但您的资源名称为terraformelb
您需要确保名称相同。
答案 1 :(得分:0)
看起来您的实例部分是错误的,它应该看起来像这样,我猜测(无法看到其余的代码):
instances = ["${aws_instance.web.*.id}"]