I'm going to say, hey, you can set up dependencies in terrible, so this might work if you need a
resource to come up before another one.
So let's jump in.
But now let's go ahead and create a folder, and I'm going to call this DEP shortfall dependency inside.
We're going to create a new file.
And as you've guessed it by now, that's going to be Mayne's T.F. What we can do again is reuse some
code.
So we go to the easy to folder inside main DCF.
Let's go ahead and copy this.
Let's make a duplicate of a resource,
someone equidae rename these two web and we'll named one of the top DBI.
Now, you can imagine we've got more of these instances and TerraForm isn't going to really respect
the order we put in here.
So let's say we've got a Web server.
But first we have a DBI server that needs to come up.
And if we don't have it, the Web server will crash.
So we need to do is set up a dependency to say, bring up the DB server first, or rather, the Web
server depends on the DBE server.
And it's really easy to do so inside here, which IPN depends on the school on equal to.
And this is a list that we type in eight of us on the school instance, DOT DBI.
So now let me go ahead and run.
Terrible apply.
It's going to create a DB instance first and then the web server.
So let's go ahead and test it out.
So now we go Sevy, we go to terminal c.D into debt.
Let's run.
Tearful in its.
Now, let's run.
Terrible reply.
So as you can see here, the order is going to create it.
We've got Web server here and the one above it is going to BTB.
And now let's go ahead and say yes.
So now what we see is it's creating a DBI.
And once that's started and up and running is Pinkins, go ahead and create the Web server.
Excellence, nobody serves up, is now going to start on a Web server.
And again, you're not limited to using just easy two instances.
This can apply to a whole range of different resources.
You can create one of the most common ones notably is Yipes.
Because sometimes it can take a while to provision.
And one of the most common places is Europe.
Depends on.
And that would be on the IP.
So just like we did here with easy to instance you'd but depends on and place the IP in there.
Excellent.
So we can go ahead and run terror from destroy.
Well, Lindsay, yes.
And that wraps up this lesson.
I look forward to seeing you in the next well.