To get started with crates and modules, let's create a new folder.
And I'm gonna call this mulches.
Inside creates a new file.
This is going to be main dot T.F..
Moleskins, it is, creates a folder inside, which is going to be multiple.
And I'm going to call this easy to get inside.
I'm gonna go over to our easy to folder.
And I'm going to copy this book of code here.
Now, over in Maine, T.F. or Watsu is set up our provider.
And again, it's going to be eight of us next week.
That region will be equal to in my case.
It's going to be EU dash w dash to now over in the easy to folder.
I'm going to create a file and we can cause whatever we want.
I'm going to call it easy to dot T.F..
Now what we can do is paste in that code recopied.
I want to do is also show you how we can pass in values because this is really useful when you start
working with Vulture's more.
It's the same concept.
You're just going to add more layers to it.
You're going to pass in more stuff and you going to work with different outputs in order to pass on
anything to our Muldrew.
We have to do it via a variable so way we can do this.
So before we could set a variable and let's say this example, we want to pass on the name of the E2
instance.
We're going to go ahead and create.
So we call this variable, we call it ECAC nine at the KLT versus we'll say it's type equal to string
and leave it like that.
So just like an input variable is exactly the same because we don't want to assign a value just yet.
Next, we're gonna set the tax from a set name equal to two vol dot, easy to name.
So now if we go with two names, let's see if and again, these are two separate folders.
What we can do is go ahead and set up and we'll do in order to set up I what you need to use the module
block so we can call it whatever we want because it's easy to Muldrew.
But we need to set and.
Where is the module?
Are you not just limited to using modules locally?
You can pull in remote vulture's in this case.
We need to provide the path of a path.
This case is going to be easy to fold.
It's going to be dot slash.
Easy to.
And so break this down, the dots represents a split here.
So it's starting from where but main CFS sets inside this module, Stalder.
And then we're saying to go into the easy to folder.
Now, everything inside here becomes the module.
And what we can also do is pass in values.
So in this case, what we want to do is pass in a string to be the name of our easy two instance.
And often if you're using of modules, this will be a parameter.
And it's exactly the same concept.
It's whatever this variable here is.
In this case, we call it easy to know.
So again, we type it easy to name equal to and we set a value.
Some call it name from Muldrew.
Let's go ahead and say that and let's go ahead and run it.
So gets a view.
Go to terminal can minimize this C.D. into modules and run terraformed in its.
Also of scaled up to show you this line here, initializing modules, easy, easy to module in these
two.
So now it's pulled in module.
And this is a really key concept and one you need to know for Terfel exam.
If you're planning on taking it is that if you make any changes to modules, whether you add them or
remove them.
You always have to run terraform in it any time you make a change like that.
So that terraformed becomes aware of what modules are in use.
Now, let's go ahead and run.
Tearful reply.
Also, let's check Minni.
As you can see here, in tax, they equal to nine for multiple sets postin the variable we declared.
So now let's go ahead and say, yes, I will go ahead and create the easy two, for instance.
Now, let's go ahead and have a look in the W.S. console.
Now over Nickled.
So let's talk in easy to.
And it's going to be running instances.
And there we go.
It a bit bigger.
We can see reiterates it an easy to instance with a name named for Molcho.
Now let's go ahead and destroy it.
So type in terrible destroyed.
And it's a yes.
Also, what I'm going to show you in the next lesson is outputs with modules.
Now, this is really key because if you're working with other modules, especially third party modules,
you may have attributes you need to access.
And the way we do it is by outputs.
So this is a really key concept to understand without all said and done.
I look forward to seeing you in the next lesson.