Multiple resources for the depends_on dependencies is throwing an Error

23 views Asked by At

I am creating a new file by the name of elastic_ip.tf with the below codes on it. I will be using a private IP for [associate_with_private_ip]

resource "aws_eip" "Test_elastic_ip" {
  domain                    = "vpc"
  network_interface         = aws_network_interface.Test_eip.id
  associate_with_private_ip = "0.0.0.0"
  depends_on                = ["aws_internet_gateway.Test_igw", "aws_instance.Test"]

  tags = {
    Name = "Test_elastic_ip"
  }
}

However, when I run the plan command, I am getting an error.

Please check the below error, what I am getting.

 Warning: Quoted references are deprecated
│ 
│   on elastic_ip.tf line 7, in resource "aws_eip" "Test_elastic_ip":
│    7:   depends_on                = ["aws_internet_gateway.Test_igw", "aws_instance.Test"]
│ 
│ In this context, references are expected literally rather than in quotes. Terraform 0.11 and earlier required quotes, but quoted references are now deprecated and will be removed in a
│ future version of Terraform. Remove the quotes surrounding this reference to silence this warning.
│ 
│ (and one more similar warning elsewhere)
╵
╷
│ Error: Reference to undeclared resource
│ 
│   on elastic_ip.tf line 7, in resource "aws_eip" "Test_elastic_ip":
│    7:   depends_on                = ["aws_internet_gateway.Test_igw", "aws_instance.Test"]
│ 
│ A managed resource "aws_instance" "Test" has not been declared in the root module.
╵

I checked few blogs and tried to add multiple resources for the depends_on, but still no luck.

Any suggestion would be a help.

0

There are 0 answers