The depends_on meta-argument, if present, must be a list of references to other resources in the same module.
In this case, you want the DBI server up before the web server starts.
provider "aws" {
region = "ap-southeast-1"
access_key = "AKI"
secret_key = "vbw"
}
resource "aws_instance" "db" {
ami = "ami-063e3af9d2cc7fe94"
instance_type = "t2.micro"
tags = {
Name = "Myec2instance"
ID = "db"
}
}
resource "aws_instance" "web" {
ami = "ami-063e3af9d2cc7fe94"
instance_type = "t2.micro"
depends_on = [aws_instance.db]
tags = {
Name = "Myec2instance"
ID = "web"
}
}
No comments:
Post a Comment