地形:找不到变量“ aws_instance.id”的资源“ aws_instance”

时间:2018-12-28 09:29:11

标签: amazon-ec2 automation terraform infrastructure

我已经开始使用terraform来自动设置AWS资源以设置k8s集群。尝试从aws_eip引用aws_instance.id时遇到问题。以下是有用的详细信息:

 ...
 path(r'^$', views.index, name='index'),
 # path('', views.myapp_index, name='myapp_index'), ## REMOVE THIS ROW ##
 ...

1)aws-eip.tf

aditya@aditya-VirtualBox:~/Desktop/terraform-states$ terraform -v
Terraform v0.11.11
+ provider.aws v1.54.0

2)aws_inst.tf:

resource "aws_eip" "nat" {
    instance = "${aws_instance.xenial.id}"
    vpc = true
    depends_on = ["aws_internet_gateway.esya_igw"]
}

预期的行为:AWS EIP必须能够引用AWS实例。 当前行为:我们收到此错误:

resource "aws_instance" "xenial" {
    ami = "${var.aws_ami}"
    instance_type = "t3.large"
    ebs_optimized = true
    monitoring = true
    count = "8"
    key_name = "${var.aws_key_name}"
    tags{
        Name = "KubeVMCluster${count.index + 1}"
    }
}

我试图通过引用Github和其他地方的类似问题来找到解决方案,但无济于事。据我说,我认为声明性代码没有任何问题。

我需要解决此问题的帮助。

致谢

Aditya

0 个答案:

没有答案