Okay. Welcome to Module 44.1. This is the time we're going to start getting your hands dirty with terra form and taking our understanding of this technology to the next level.
Just a last minute, quick preflight check from the prior module. You should have an AZAR account test account set up a TTE this point. If it's really plain Jane default, it's gonna look a lot like I have here on the screen when you first log in.
You should also
have the, um, intelligent I D editor up and running and installed on your own workstation. Additionally, you want to make sure you have installed the Terra form plug in for Intel, Ajay, That provides some nice functionality that will be getting into
in this. Ah, this particular module, in fact.
And it will be very helpful as we move forward. And then, of course, finally, you want to make sure you have the terra form command line interface
version 1.28 or newer
so soon you have all those and then, of course, the very, very last step being to clone the course materials from get hub. And if you didn't don't didn't get to that didn't do that. Check out the very tail off. Um,
the last module three, where we were going through that process and
pulling them down from get hub. So it shows up right here in our on our I d editor. I'm gonna be hopping back and forth between the intelligence A I D. E and the web browser. So we can
a CZ We look at different things here. So, um, first a little bit about as her. I said, You don't have to be an expert at it. And by no means do you, um, one concept that is a bit unique to wizards called resource groups in eight of us G C. P.
You usually will take your resource is such as virtual machines,
storage containers, kubernetes clusters, these kinds of things and you organize them using tags and other things those concepts do exist in as their auras. Well, but all resource is regardless of the kind, are going to be put within a resource group. That's kind of your container.
So everything always sits within it. One resource group and only one resource group.
You can then create tags on top of that. But the base organizer for Mazar Materials is in a resource group. I bring this up because in our first set up here, we are going to create the most simple terra form file,
and that terra form file is going to be creating
and as a resource group. Okay, I'm gonna move this into presentation mode to make it a little easier for you to look at the i d. While we're opening up the code,
first thing we're gonna do is in the Basics folder. We're gonna open up the main terra form script, which you can see here on the screen.
Top of mind is comments. So in your terra form files, you're going to be creating comments. Things can be done using several different formats. Single line comments are with the hashtags as the leader or with a double forward slash much like you do in a lot of common
source code development languages.
Job A C C plus plus, the other style is the multi line comments of the forward slash star. This is if you have ah lot to say in all, and you want to capture it all in one single block.
So that's something that is, regardless of what? What you're doing, what you're making. If you're making in terra form file,
that is how you do comments. The next item you will quickly notice is provider. So here we have. We're using a provider called Azure R M. So I think it's very important that you understand providers because it's really a basis for a lot of the, um
the way that the Terra form works holistically as as a product. So you can see here we have additional resource is and I have a link to the actual terra forms master page of all the different providers. So providers include a Tzar Google Amazon web service is these major cloud
providers All have providers
and the whole point of a provider within terra form is too abstract. The specific nuances of communicating with the A P I level from you when you're writing the terra form script. So when you're interacting with azar, you're not using the azar proprietary Sze
As a resource manager, you're not using the Terra form or excuse me, The AWS is cloud formation proprietary format
that you also find that there are some providers for a lot of things other than actual cloud providers. For example, there's a my sequel provider can be very helpful if you create an instance of a my sequel server. Say you do it on AWS. But then you want to make sure your scripts also initiate databases
within that, my sequel instance.
And maybe they're doing things like setting permissions, creating database users and doing some other initialization sze as one example again, there are a ton of providers that you can see in this list, and it is consistently growing. So I definitely recommend you take a good look at providers
and take a reference of this
so that when you're going about doing your development, you have a general feel of the different technologies. And if you're using those technologies, you can take a look at the provider in terra form and and get an understanding of what's the value this is gonna bring it. What kind of things can this
specific technology provider helped bring to the table? See, or terra form scripts are more efficient, effective in comprehensive,
so flipping back to our terra form file itself, we talked about the provider first section. In this case, we're using the observe provider. Secondly, you'll quickly noticed there's a kn attributes in this block. This is the general syntax for terra form. It's called the Hash E Corp configuration language.
Is this in tax? It's kind of like Jason. It's kind of a mark up. Not so much
like an XML, though It's kind of like code. It's its own thing, but it's pretty easy to read and understand and look at it, and one of the attributes you'll notice in this provider block his version. So when you're using these different providers,
there's always new versions. Revisions, fixes being released by the open source community that is creating these providers. And typically you're gonna want your your scripts to lock version into a specific version of a provider, or at least within a range. So in this case, I have specified
that any version one dot X's long as the major releases one
dot something that version of the provider is acceptable in it will work, and that's just a general. Best practice for Terra Form is as lock it to the major version. I could have been very specific and added the version to be 1.20 and so forth to really lock things down
so you can give kind of, ah range of acceptable versions.
Or you can really lock it down to a specific version. If if you're concerned that they provider you're using is undergoing fluctuations and really isn't able to be backwards compatible is new versions of the provider comma out in a released
tour eloquently beneath that we are creating a resource. This particular resource, you could tell by the name of the resource is there are m This resource type is coming from the terrarium
provider. Specifically, it's a resource group is the resource that we're defining. I'm giving it a name which we'll talk about those in a second called RG,
and then you'll notice it has some attributes first and foremost Attribute is name, and so this is going to be the name of the resource group that gets created when this terra form script runs and then secondly, you'll notice there's a location. So there's the various different regions that is, er has west, us West, us to east us.
There's a whole bunch of them.
This isn't a course on as ER, but they have regions around the globe, so you will typically have reasons for selecting one region over the other, whether it's cost where its availability sometimes. And in this the same case with Google, it's the same with Amazon and pretty much every major cloud provider.
There are certain capabilities and resource types
that are only available in certain regions for one reason or another.
Okay, so I want to spend a second now that we've talked about the provider and the resource construct just kind of navigating the IittIe because you're going to say, Well, boy, there are a ton of different resource types that Thea's there are M provider realizes and helps us implement.
Um and it's the same case for AWS provider all these other ones. It's really similar. So what I could do, though, because we're using an I D on. This is why
we're really pushing to do this, is is I can start just typing code here, right and leverage the auto complete capabilities. So I just start typing on a new line, are yes and then goes Boom. Okay, now it's already establishing a block for me, and then the next. Because I've imported these, there are M
provider. It's giving me a full list of all the different providers
now. It's not giving me all the details of what these providers mean, but we'll get into navigating the specific resource types that providers provide in a minute. But the important thing here is is I can navigate and kind of get a feel and say, Well, you know, I I think I need
I know I need to make some sort of a virtual network.
So let's see. Okay, we have virtual machine. A. Here's a virtual network. I could do gateways Aiken do peering. I could do a one and I have a few options, and this helps it a little easier for me, cause then once I select, I want to make a virtual network. In this example, it's automatically populating all these different attributes because depending on the resource type that I'm crying to create,
definition itself has certain attributes that need to be defined that are required. There are also going to be optional attributes, so I'm gonna hit control plus the space bar, and it's going to give me this. This context menu as well, which is listing out ah, variety of other optional attributes
as well as is some other other languages and tactical options
that I can use toe work with when writing my terror form scripts. So that is an idea. If you're not familiar with working with integrated development environments is a huge reason, and that that it's a value and why I wanted to really make sure we're using the intelligent idea highly. Recommend it when you are doing your development
so that it helps. It'd make it easier for you to write your code and to explore
the different providers that that auto complete is just so valuable. And finally, the intelligence is one of the more mature when it comes to auto complete for Terra form scripts, in particular in the Hash Corp configuration language, which is the reason that we're using that.
I know visual studio code also provides a plug in,
and and I would suspect that other major ideas, like Eclipse, provide ah plugging as well for myself. I've only worked with visual studio code and then, of course, within tell Ajay. So I'm gonna delete this little area and clean up
bringing us back to the original file that we had