2 hours 48 minutes
Now that we've taken a tour of the Terra form file itself, let's take a brief stop and look at the Terra Form command line interface.
I have seed into the directory that has this terra form file the dot T F file. You can see 01 basic is the folder 01 Basics is the folder where the file is that we've had opened.
Then what I want to do here is I'm gonna run terra form dash help. Uh, and this is giving me a breakdown of all the different sub terra form commands I don't intend on covering each and everyone. But take a look at him. We will cover several of these. Um,
and there's a lot of other things that we're not gonna cover
as you get more advanced and start getting more comfortable with the fundamentals and you want to expand. There's a lot of helpful little utilities in debugging and an understanding when you create more complicated terra form files that I wanted to highlight. One thing we are definitely gonna have to do here
first step is isn't in it and performing the initialization, so a CZ part of this is You can see, according to the documents, you know, new existing terra form working directory. So I just seated in this directory. I haven't done any initialization just yet. And what I want to do is I'm gonna have to initialize
and we can see here. There are a lot of different
additional arguments that could be provided for the unit command. I highlight this not to dive into the details of all different arguments for innit? But again, toe highlight. We have terra form dash help, which gives us a breakdown of all the basic terra form commands. And then, for each one of those, there is a more detailed
breakdown of the commands
of different additional arguments that can be sent to the different commands. We're gonna clear the screen here. Okay, So now we're going to run the actual terra form, innit process. And as we can see here, it's actually downloading the provider plug ins. So in this case, the only plug in
the only provider that we're using is is is there are m and
we can see it downloaded version 1.34 and again because we specified we needed a one dot x version, the latest and greatest. That's what it's pulling. If I had said I want 1.2 and specified that up in the actual Terra form file, it would only bring in version 1.2 and it would keep that constraint there.
once we have initialized it, we could now run the Terra form script. But before we do that, I wantto take a minute to preview and ask terra form, knowing this script that we've created on and knowing what I want you two to build over a Nazar which in this case is just a simple resource group.
Tell me the plan
of action that you have
And so I'm gonna run terra form plan.
First thing we see here is there's an air
and the reason I'm getting this air is because it's trying that the desert client provider is trying to connect Thio azar. But
it doesn't really have an identity. It doesn't know who am I talking to? Who am I working asked. So what I can do now is is in this shell. I'm going to go and use the ese command line utility to do a log in.
And so what that has done is launched a browser window for me, through which I select my log in, and now it recognizes who I am. And this is part of the ese command line. So we have now authenticated with Azar
as a particular user. In this case, I am authenticating myself as this same user
that you see logged into my trial account. So when you log in to Azar using the ese log in, you're gonna want to log in using the same account of in the case you have multiple Microsoft accounts using the same account that has the azar subscription that you are using for these activities.
So once we've logged in,
we are in a better spot, and we're going to run the plan task again.
So what it's doing is it's reaching out and, um, understanding. Okay, what is the state of things? As faras Terra form understands it, what are the states of the things in the cloud provider and based on what it understands the state to be, which currently is nothing, it really knows nothing about what's in.
That is their subscription that I just logged into
what it figures is well, I'm My plan is to create a new resource group. The idea's gonna known after we run it the location in the name of that resource group. Those things air defined. And that's exactly what we defined in the pair Terra form file up here.
Andi, that's that's it for the plan, right? Is this is a very simple terra form file,
but that's the plan. So I say Okay, I like that plan. I'm gonna run terra form, apply. And what we're doing is we are applying the actual terra form script, so it's gonna prop me. Here's it's reiterating again. Here's my plan. Here's what I'm gonna do. I'm gonna create this resource group.
Do you want me to do that? My answer is yes.
Please go ahead and create that resource group and there we go. So it completed it and then it's giving. This here is the ice I d of the resource group itself on the temporary that Azera subscription I have and for
our own purposes, I'm gonna navigate back to the user portal just so we can see this whether our very own eyes
click on the resource groups lists and we'll see. Sure enough, there is a resource group. TF basics resource group has been created. Indeed it is. In the West US To location, of course, is with my free trial subscription.
So now we have created looked at the most simple terra form file and run that terra form file. And it's created a resource group in the Ezer Cloud for us.
Before we finish off this module, we want to do one final thing. And, um, that is we're gonna change the name of the resource group and figure out how does Terra form react?
Um, to doing that. So up here in our Terra form file, we call that basics resource group. Let's call it basics to and then say that what I'm gonna do this time instead of just going directly to the apply face, I'm gonna run plan again, and I'm gonna
This is this is my opportunity to ask care reform. Okay. Now that I've updated this resource file, you know what you know about the resource group that we created
a little bit earlier? Let me know. What do you What is your plan of attack here? What do you ah, intend on doing. And so what it's saying here's is that this resource group that we called our G it's gonna need to be replaced because I'm changing the name. And the way is there works. You really can't perform a rename operation on a resource group.
You just create a new resource group with a new name and you get rid of the old
resource group with the old name. And so that's what they mean by forces replacement. So I'm gonna go ahead and terra form apply. And now we've gone ahead and we've changed the name of the resource group. We checked out the plan. Let's have terra form, take the actions that are necessary.
And when this is all said and done,
we're expecting that we're going to get to a point where the resource Group TF basics to exists and TF basics does not exist, so we can even see as terra forms performing these actions and putting it out to the console, getting some updates. First step, it's destroying
the resource group.
This may take a little bit of time,
Um and then obviously, then the next step is gonna be creating the basics to resource group.
Okay, So fast forward. About a minute or so and the process completed, it destroyed the old resource group and it created a new resource group called Basics to I'm going to run the Terra form show Command just to get some more details on that. And and sure enough, there it is, the basics to
If I navigate back to the portal and I hit the refresh there, we can see there's no longer a group with just basic stash RG. There is the basics to RG so that wraps it up for this very first hands on lesson in module 4.1.
Hopefully, you've got a good
feeling for how do we What are the steps of creating the most simplistic terra form file? What? The major components, the providers in the resource Is those air big? You also have a feel now for the terra form cli specifically the innit? The plan
in the apply,
terra form commands these air very, very important show is something that we're looking at here. You may not run that much aside when you're kind of debugging and getting to know the system. So I look forward to joining you in the next module very soon
Kali Linux Fundamentals
If you’re interested in penetration testing and ethical hacking, then this Kali Linux course is ...
1 CEU/CPE Hours Available
Certificate of Completion Offered