OK, so what we've done is we've gone ahead and set up our back end, it's free buckets.
But now we need to go ahead and use it in tearful.
So what we can do is go ahead, create a new folder.
And I'll only call this back and.
Inside of recruits, a new fall.
Which is main.
Dr. T.F. inside we can at our provider and our provider is going to be a W.S. inside here on this region.
And I'm gonna set it equal to EU dash w dash to what we could do is create a simple resource which is
going to be a VPC sort a resource, and we'll go ahead and create it.
So is it obvious unschool VPC?
The name, we'll call it test and only has one required parameter, which is a Seida block.
So we set out to 10 zero zero zero slash 60 optionally what you might do is create another file.
And this is the way I've normally seen it being done in industry.
You can't have it in the same file, so you could have it inside Main T.F..
But one of the ways I've seen it quite commonly done is to have it in a separate file.
So you would simply call this back end dot t.f. and the syntax is a little bit interesting.
So I'm going to type in tearful.
And what this does is it tells TerraForm we want to make a configuration change.
Now doesn't sound too daunting.
It doesn't mean we're changing how terrible works normally by default.
It wants to create mystate locally by making this configuration change.
We're saying we want you to store the state somewhere else.
And to do that, we're going to type in backend.
Then we're going to say what type against use?
And because it's eight of us is gonna be tight.
It's free.
I'll include a link for all the other Parkin's you can use.
One of the really cool ones I've seen has been terrible and cloud.
Quite powerful products.
And it looks pretty neat.
And you can do pretty much everything we've been doing.
Terrible reply.
Terraformed, destroyed.
All up in the cloud.
But that's the subject for of time.
So we need to do is put in a bucket.
And we'll paste in the one we just created.
Next, we need to add the key.
This is one of these really confusing things.
And I'm going to help you avoid the same mistake I'm normally made.
This is the folder path where you would like to store the state file.
Now, normally, the way we describe it is to say the state file.
We don't say much else about it.
So we want to do is make sure we don't put any slashes at the beginning.
So if you want to put it inside the folder.
Let's use TerraForm for an example.
Then able to put the file inside of it, put it forward, slash and the name for state file.
I would like it to be courts.
In this case, I'm gonna call it T.F. State dot T.F. States.
If you didn't include this and left, just terraform.
It's going to create a state file called Terrible and you may run into issues.
This is the way you want to set it up.
You don't have to use the folder.
You could just call it T.F. State dot T.F. States.
That's absolutely fine.
This is just my personal preference to keep it inside a folder.
Another thing we need to add is the region.
This case is going to be EU dash w dash to we will see to pass in an access key.
And a secret key.
They don't have to include his in the coat.
Well, you could do is leave his blank and they'll pop up like input variables for the purposes of this
course.
I'm gonna go ahead and answer.
Suppose now if you're a Mac or Linux, you can use this command below to go ahead and access your credentials.
That's if you've set it up in the WSC ally.
Now, you may be wondering why does it need these credentials?
One of the reasons it's asking for this information is because you might have specific credentials that
only interact with that buckets.
But again, you're not limited to using just an S3 bucket.
You could use something on a Zuhur and you'd have to pass in a zoo credentials.
But now we've got over set up.
Now let's go over to our terminal.
So gets a view.
Let's go to Terminal S.D. into packaged.
And now let's run terraformed in its.
So you can see we're now using an S3 backend.
And if you come from recertification course or you're planning to take it, you'll see that if you're
using the state locally and then run terraform in it, it will then ask you.
Would you like to convert your states and move it over to the cloud?
Or move over to the free back end?
And it's up to you if you'd like to do so.
Now, if you have sobieski back and it makes sense to go ahead and use it.
Now what we can do is go ahead and run Terryville.
Reply.
I'm willing to, yes.
Now, if we go back over to console and click on the buckets, we can see we've got a follicle terrible.
And you can see we have a T.F. State file.
So this means the VPC, we've just created it state file and all the information about it is now stored
in these three buckets.
Now, what we can do is go ahead and run, terraform destroyed and lives Down syndrome.
Terrible and destroy.
Well into.
Yes.
Excellent.
Then we'll go back over to eight of us.
We're going to delete this folder and all its contents.
And then if we go back up a little, we'll select our buckets and delete it.
You're going to be required to type in the name.
And then confirm and go.
That's how you can use remote backings in terror ful.
That wraps up this lesson.
I look forward to seeing you in the next will.