Hi and welcome to this lesson.
As you saw in the last couple of lessons, we went through and created a first aid W.S. Resource and
I touched on the idea of a state fault and why it's so important, Susan, is less than what we're gonna
do is demystify the state fall.
But one thing I really want to stress is that this is like the heart of terrible.
It's the most important concept.
And it's also the most important file.
Without it, terraform simply doesn't work.
So we go to our explorer.
We can see inside our first resource folder inside.
We have this vault called TerraForm Dot T.F. State, and that is at stake file.
And as you can see here, it tells us what version terraform we're using.
And there's not much else in that.
And it's also written in this Jason format is the number fall below, which is a backup just in case
something goes wrong.
And you can see here it's got some details about how VPC but this isn't the current state file.
So why is it so important?
Well, it keeps track of all the changes we make.
And it's what TerraForm uses to reference against whether we're creating something, deleting something
or updating something.
Let's have a look at this in action.
So we're going to view go to terminal.
I'm going to minimize explorer here inside.
And we know what we're going to create.
It's a VPC, so we could do terrible apply.
Go ahead and insur.
What I'm also going to do is over my explorer, I'm going to open up the state file.
And watch what happens when we enter.
Yes.
Did he catch that?
It was really quick, Winterfell went ahead and sent off a request to Amazon to go ahead and crate's
out VPC.
When Amazon reply to say yes, it's been created, all those computed fields have now been entered.
And those are stored inside a state file.
As you can see here, we've got the site, a block which we entered.
We've got the Amazon resource name and it's all stored inside this file.
And again, it's one of these really critical things that you do not want to lose this file.
And we've only set up a VPC, so it's no big deal if we delusive this file and then delete it VPC because
it's only one thing that we have created.
Vishy becomes when we're working as part of a team and we have entire environments set up and the state
file goes missing.
What we'll do later is we'll cover more advance concepts when it comes to states and what you can do
in certain situations.
If things have changed or is otherwise known as state drift is a bit advance for now.
But important concept to know is about the state file.
This is the living beating heart of terrible, and it uses it for keeping track of any changes and any
resources we've created and any we can to delete.
She may remember when I went into my A.W. console, I had more than one VPC terraform is only aware
of one, which is this one, because that is the one at Tearfulness created and it's the only one inside
the state file.
Now, if we go ahead and delete this terrible and destroy.
And we enter to yes.
There we go.
That state fall is now empty because there are no resources created by terrible.
So there we go.
That's been a quick overview of the state file.
I'll look forward to seeing you in the next video.