Learn Terraform From Basic To Advance | Azure Terraform | Aws Terraform |
uh okay sorry so as I said terraform is ISC infrastructure as code and maybe some users within this group may have they they would have known anible or puppet or Chef or any something so they are they also fall in this category of languages okay so uh kind of these are uh not traditional languages like Java python C C++ okay so and Terra main mainly in organizations they use to create resources in in Cloud okay so you can create other resources as well like you can manage networking stuff as well in that F5 load balancers DNS many things but in general what I've seen across organizations they use it more to manage resources um in in Cloud either it could be AWS okay Azure or gcp or multiple like multic Cloud as well because now organizations are also going for multicloud so then it's better like you don't have to train the team to to know the uh infra coding for other languages okay so you don't have to know arm or bicep okay or if you are going to AWS also so you don't have to know that part or gcp also they would have their own native way of infrastructure as code so instead of knowing individual things you just have to know terraform uh then you can create resources in any Cloud okay so like this is the uh kind of uh let me share my screen okay yeah hope my screen is visible okay yeah yeah okay so to learn this skill okay what all things you know uh is is basic knowledge of any Cloud technology okay AWS Azure or gcp so we can do the mix like we can create some resources in AWS and Azure okay but this course is not to know all the cloud resources okay using terraform you can create like and number of all the things but we are not going to train or know how all the things work okay we are going to FOC Fus more on the terraform part only okay so for example let's say Azure or Azure so in Azure you can create a function app also you can create a compute VM as well and you can create vet subnet everything okay using the terraform so we we have we will know how to create like the resources but not each and every resource okay because this is a generic kind of language to create resources similarly for AWS also we will do couple of like um uh the main common objects which organizations create we will go through those so then it will give you the idea then how to create any other resource what whatever you encounter okay maybe in your project you're going to create a AWS Lambda function so how you can do it through the terraform we will okay like that and uh if you have some basic knowledge of programming it's it's optional but um no knowledge is also fine okay because this is not a traditional language okay and if you are aware of any other declarative language like puppet arm and cble so I'm saying these are declarative language because they this is not a traditional kind of language they are fixed schema like there is a fixed way of writing it so that's what and you just declare the end State how your your final configuration will be so here also in terraform also we do that we create we just tell terap that our final State how it is going to be maybe you want to create a a a vet a subnet and a VM inside that okay so we just declare those three things and we let terraform create it okay we won't tell which sequence to take and that it's headache okay uh this is like kind of a old slide now like ter this initially I was doing the searches and all in LinkedIn and all how the terraform skill is evolving so it it's in Pretty in good demand okay but it not only single terraform um if you are entering into this like devops or Sr so only learning terraform is not going to land you a job or okay just to be clear it is a additional tool like this is a must have tool I would say uh in in your tool kit okay and the topics which we are going to learn um are are more on kind of U you can go a certificate Focus as well or you can these are from the job point of view as well okay which we Face day in day out so the first our topic will be the introduction where we in the first day we will uh do uh what all tools are to be needed and we'll get that installed okay I will tell all the tools needed and you will go and install it and if you have some subscription to a cloud okay that will be needed because you're going to create resources okay and you will create the resource and delete destroy it immediately so charging wise also it will be very less okay whatever you are doing so definitely that is a must have and so we will get get you like running on the first day all the tools everything necessary uh will be installed okay then we'll start the basic of the terraform how the structure of the terraform language is there and all and terraform is mainly kind of a block languages block language okay so it's not like a traditional python Java like that so everything has to be defined within a block okay so we will learn those part and there are fixed number of blocks in terraform so once you you go through all those so that is job done okay so there is not nothing outside of that so there fixed scope of that so then we are in the next third uh section we will create resources okay and uh here we will introduce to the resource block like as I said everything is a block so this resource creation is also a block then we will we will see some meta argument some special um options are there how to further enhance that block okay and we will create a lot of resources in this so this will be a fun module where you will get more interest and you can play around on your own even once uh we create some uh resources in this then you can explore okay all the resources whatever you want to whether you may be want to create some resources in AWS Azure or gcp so this is the module you do okay so once we are done through that now we know how to create resources then the most important one is terraform modules this this block this is used in organizations day in day out so whatever resources you are going to create you want to share it with others okay and you want to hide the complexities and all that stuff okay so there comes the modules very important topic whatever you code in actual organization ations everything is in module okay and after that uh terraform State this this module will give you more in depth how terraform manages its resources okay and track the changes in all this and then expressions and functions uh how how to do like small modifications like formatting of data okay getting IP address okay string manipulation all that thing okay for example let's say uh a uh as your uh resource ID maybe is there quite long with multiple forward slashes in between you want to remove those and you want to strip you want to get the only the maybe the fifth bit of it okay so these all will come here in this okay and next part is logging and debugging not use day in day out but you're in troubl shooting time uh we we have to know this part okay then terraform Cloud okay we in the in the intro part itself we will see what are the offerings of terraform like how organizations use terraform okay so open source is there and the hcp the cloud version is there and the Enterprise version okay so here we are going to learn the uh the cloud version okay and um we will do the we will do the integration um we we'll kind of a create a pipeline and and run that okay and sorry is it at the end we are going to yeah integrate with Azure devops as well okay so there are many pipeline uh Choice choices will be there in organizations so we we can't cover everything so organ usually organizations may use genkins okay or GitHub actions or Azure devops and all okay so P this course is not completely for pipeline but yeah this will be helpful for uh your uh actual working okay because you have to be aware of little for the pipeline side as well once your terraform code is there you want to integrate that with the uh some pipeline tool okay some devops cicd tool so here we our in our course we will use Azure devops okay so these are all the topics which we will cover okay [Music] and terraform uh as we as I said initially it's the ISC tool okay so ISC stands for infrastructure as code so whatever your infrastructure is there okay talking about Azure it could be Resource Group vet subnet your compute VM so everything is codified okay everything is there uh in you can put it in a note notepad in flat files okay so once they in the files it is easy for you to track the changes any anybody maybe did some changes uh in a um uh in a compute V maybe they increase the hard disk or increase the memory and all okay so if if you're not using IC and all what earlier we used to do is let let's say uh project teams will be there then some operations team will be there okay so the project team will create their development uh infrastructure where uh they will create all the resources okay and do their development there will be some time scales will be there and once it is there they will hand it over the information to the maybe the operations team some other team to create the production infrastructure okay so during that part of Handover a lot of information may get Miss okay for example uh during the course of your development project some hard dis got changed okay some size increase or some something got fixed as as part of troubleshooting okay some changes happened so those changes may may get missed out during Handover and you have to create bulky documents screenshots and all that stuff okay before before terraform or on any other tool like if you're doing manually like that that those was that was the way okay how we used to do so now when terraform is there uh whatever changes you are doing you are doing the changes on the on the terraform code itself okay and as you are changing the things in a code so you can easily Version Control it okay using uh git so then all the track all the changes are known what changes happened when it happened okay so that that's the main benefit of it and in that way you don't need a lot of documentation you just hand over your code whatever you created in development to the to the next team okay who are going to create the production infra okay and they just have to change the parameters and maybe Resource Group and all that stuff okay and they will create so a lot of things will be reused in that way and it saves a lot of time uh to replicate environment okay and terraform language uh is is a declarative language okay so it is describing kind of intended goal okay so we we don't tell how to do it and all we just tell it what we need that's it so that's why it is bit easy for uh the uh people who are from the sis admin background infra background and all okay so it's not full like uh programming stuff in that and uh the current version is is latest this slide is little bit old but yeah the versions but the basic programming everything is same in that okay so current version is I think 1. n.x something so it's major version minor version and the patch fix like that that Creed and terraform is uh like it is the tool from the vendor called Hashi Corp okay and they have their own language uh kind of um syntax it is called HCL okay Hashi cor and configuration language so it uses that I'm not sure maybe some people if they are aware of Packer or if they have used packer in past so Packer also uses the similar HCL kind of language okay or if uh users who have got introduced to bicep so it is similar to the bicep like bicep also took the um things from like the pain points from arm and they they created similar ones so the look and feel and the style looks same okay and that and you can either program it through the Json as well but it is very difficult in the Json way the HCL weight is more human friendly okay toar to see and view the program uh this was kind of bit slight is not that mandat because just the slide is telling that organizations are now going for multicloud and all it's very common okay initially couple of years ago they were going from infra to Cloud but now Cloud to multicloud is a very common Norm okay and Hashi cor set of tools are very in demand in that okay uh some of the things we just discussed in in the traditional way if you're are not doing through the terraform or ISC way it is very slow okay if you're doing manually let's say you got a task to create 20 vmss okay and 20 you have to do all the related infrastructure as well if you're doing an AWS maybe you have to create VPC route tables okay uh net gateways everything in that do the connectivity part create separate subnets for that and do the VMS okay and creating that for a a large chunk like 10 or 20 again it will be a problem uh so it will be a manual exercise takes a long time and replicating that across two environments like let's say development to uat okay or QA or staging like that if you want to replicate again it's a it's a pain so it it's very slow in in traditional way before IC where we are doing and difficult to record infrastructure specification you have to create like document files screenshots everything whatever you change if you have to give some hand over some other team to create or replicate so prone to errors across environment these are not consistent and managing the life cycle across a period of time so let's say you created a development envirment so across like your development team will use it for 3 4 months then once the product is ready you will go for your um staging or production like that okay so many changes would have happened during the time so again you have to record those things okay Again difficult to share and infrastructure drift is a possibility so maybe in the documentation it is showing the the ram is 16 gig but in actual it is maybe 32 gig something some to solve some problem somebody upgraded it so these are the pain points okay which are there in the point and click way of working okay so these all Point these all are addressed in the infrastructure as code way so what we will do through the terraform um is a declarative or descriptive way so we we we do the code of it and push it to the cloud wherever it is there it will create all the resources okay and you can uh use it on on Prem VM managing as well and Cloud VMS Cloud resources networking storage we will see now like what all things we can create using that okay and uh there is nothing GUI as such in this in terraform okay so it's this tool is not kind of a GUI based tool you you code you can use a notepad as well but people use uh some IDE tool okay like for visual studio code is pretty common in that so we code in that okay and uh IDM PO is a principle of instruct code so in any language kind of you can see puppet Chef all that declarative they this term will come item portance so you run the code multiple times the result will be like same it is not going to change okay so these are the principles of uh ISC so this follows that and the pref approach of I to declarative definition files uh so we don't do traditional programming like that so there is a fixed way of doing it you just declare your final State and uh job done okay so in the meanwhile let me just open the browser so this website registry. terraform doio this will be a very common place for you to visit once uh you working in in devops or S okay so this page will tell what all things our uh terraform can be used for okay so we first we go to providers so this providers means what all things it can create okay in so AWS aszure you can create resources in gcp you can create kubernetes Alibaba all all these resources you can create okay and these numbers kind of you can see 4,200 so different vendors so any vendor like whatever infra they're doing maybe F5 load balancer or anything so they they try to give some plugin to Hashi or terraform so that users can create resources using terraform v as well so that's why the vendors you will see the vendor count will be keep on increasing okay but our main focus will be like kind of AWS aure in that way okay but yeah this this shows that it has um you can create many other things okay so the benefits of uh ISC we just saw the manual way of doing it it's takes slow and consistency is not there so here consistency will be there and across environments you can build and deploy okay the same code can be used just by changing the maybe the location or the resource Group or something you can create a similar uh replica okay repeatability is there you can create resources many times you can destroy it and then create it again okay and highly efficient way of doing it okay and obviously lower cost because your time is saving in that way and increase in quality and sharing of I code so once your code is ready because these are just set of files okay no like heavy bulky screenshots and all that stuff it's just lines of code so it is very easy to share and put it in GitHub or whichever your git tool you are using okay and you can share it across your teams so as I told Hashi Corp is the vendor terraform is its tool and kind this kind this is kind of the Block Level language okay so not like a traditional language how we used to do like Python and all so the the everything has to be declared within a block nothing outside the block okay so all everything to declare a variable also blocks will be there to present some output also block will be there to create some resource block so everything block so in this course we will go through all the blocks okay and um once we are done through all the blocks yeah so completed in that you can create all any Resource as uh you want okay and terraform lets us create resources in human readable so this this form you can see uh this is the HCL format okay Hashi configuration language so you can see it is very human friendly kind of a easy to uh read so for example in this one we are creating a resource Group in Azure so uh just passing the name of the resource Group we are giving the location okay so it's pretty uh user friendly similarly here in this case we are creating a AWS instance okay and just passing the Ami what to use instance type whatever tags will be there okay so it's very kind of human friendly to read and see the configuration a lot of documentation is not needed but just by glancing through the code you will know okay and also we will see towards the uh course how to there are tools which can generate your documentation out of your code okay and uh because these are set of uh code so we can use version control of it so in this course yeah whatever you're coding you will do it in GitHub and all for your pure practice you will uh practice locally but at some projects whatever like the kind of tasks I will give kind of homework so those you have to keep it in your GitHub uh uh page okay so that I can see like how you progressing in that sorry yeah [Music] and this one is kind not relevant I won't go through this mult like cost saving and all because uh the projects they're going for multic cloud and all so they want to use the cost efficiency so some resources will be cheaper in other Cloud okay so that was the cost not relevant so much now so yeah so the current provisioning process is like this you have Azure AWS or gcp so Azure we may be using a a CLI or arm templates or bicep okay so for AWS also we have cloud formation tool or AWS CLI okay or you can even use Powershell so for gcp also there is a separate deployment manager so for each Cloud there are separate tools native tools are there okay only for that specific Cloud okay so your team is is proficient in doing this way but if if the business business organizations want to use separate Cloud uh due to the cost benefits then again the challenges come to train all the team okay to how to create resources in a auto automated way so again for example if the organization is azure Centric they want to go AWS they want to know the team has to be aware of cloud formation AWS CLI all that stuff okay so this organizations want to change it to like this the Azure AWS gcp which will be there in the back end in the and on top terraform layer will be there so whatever the teams are there or users are there they will just know terraform once they are aware of the terraform they can create the resources in across clouds okay there are some other iac's as well puppets are fible okay cloud formation Azure arm templates they all have like similar kind of thing where they you are you're telling the final uh your uh destination how it should be your declared okay so here also we can see this declarative approach we we are we are telling that okay this is our destination we are our final state it should be like this there should be a a resource Group by the name demo RG and location in this we don't tell how to create it and all it will terraform will create it okay so all these language have that thing in in common okay where we declare the end State how it should be and any deviation and all it will um let us know okay and Terra is cloud agnostic you can use it for any Cloud organizations typically use it for these three but there are other Cloud as venders as well we saw in the uh website ter IO Ali Alibaba cloud and all the other clouds as well you can use it Oracle Cloud as well okay uh it leverages providers we will see uh down the line water providers uh it provides a common tool processes and language to be used across Cloud so by this diagram itself it's pretty clear then once you know this layer then it's headache of terraform to get the resource created in each one okay so you just have to know that that there installation and setup so in the first day when we do the course we will we should be ready to um like hands on on on the first day itself we will get the terraform Tool uh installed on your system and it's not a very heavy tool you don't have to install it's just a binary you have to download and keep it in your path variable that's it then you have to know some ID you have to download some ID or Preferred Choice will be Visual Studio code it's again free terraform is also free we will use the open source uh then in Visual Studio code there is a terraform extension uh Visual Studio code if people are not familiar kind this is kind of a IDE okay where uh we use and when whenever we are coding we we get lot of help okay so for example here we see you can see it it is already giving me a help Okay so let's say I want to create a AWS maybe am under am user something like that okay so a lot of things automatically it it gives me and here also it it tells me within this block what all things will be there okay so it gives me a lot of help and intelligence so for this a plug-in is there natively this uh doesn't support so we have to install the the plugin in that once our Visual Studio code this software is installed then we will install the plugin so we will get we will get all these intelligence so we don't have to remember a lot of stuff okay again because this is so Dynamic and all you don't have to remember stuff every time you have to because versions are changing across everywhere your Azure side changing aw side terraform so we have to follow a lot of stuff in the documentation part as well okay so uh in the in the first day in the introduction we'll go through that part as well so for example let's say Azure I'm just taking a random example Azure RM so if we want to create some resources in Azure RM we we we take the they already give these two blocks in terraform okay we just copy and use it and then anything you want uh in that go to the documentation so because any resource won't be aware of all the things in ter like Azure has n number of things okay starting from AI to networking to all so whatever you want to create you have to go to that specific part and we will get a um a sample code as well okay so they will give a pretty skeleton code okay where we can either follow and we can change it later here we can use all the possible arguments in that okay so so we will even get familiar on the first like in the in the introduction section for how to use that our documentation part uh to our benefit and a subscription is also needed okay and aure CLI tool AWS CLI tool and if somebody is they're doing Google so they need Google SDK as well and git also will be there okay so you have to install git so using these tools uh we are fine to um uh go to create our resources and every all the stuff so these are in this page it is showing what are the main kind of supported Cloud platforms are there organizations use or AWS a gcp are the main ones but it supports Alibaba Cloud Oracle Cloud platform digital ocean IBM Cloud okay so these are the some of the mains uh are there so I'm pretty sure like many of most of your group will be either AWS or Azure Centric okay and uh this is some of the Azure side I there earlier there used to be a free kind of azure you're uh not sure you have to check it out if the free kind of uh option is there or not okay but I will share the link with that um but I I'm using the paid subscription one and it is not very expensive because whatever we create we just destroy it within seconds because we are testing our terraform skills once it the resources created we'll uh test it and destroy it so cost wise it is not very expensive similarly for AWS also uh we can uh check it out like how what all free options are there in that and get a membership for that okay a for the gcp also uh there like we can check the pricing and get the subscription in place like whichever whichever members they want to learn in whichever Cloud okay so again it's not mandatory to know every all the clouds because our Focus is main on the terraform okay and our course will be mainly on Azure and AWS okay we'll create some resources for AWS and some main ones from Azure and Main ones from AWS okay and uh next in the first day we will download our terraform uh binaries for that for each mostly us users might be using Mac or Windows okay so we'll do the we'll do it on Windows but there is no difference in your programming whichever version you using either your system is a Linux system or Mac or anything your terraform codes remain same okay uh then once your code is there once a terraform tool is there you have to connect the tool to the to your respective Cloud okay so might be you are using AWS or Azure okay or gcp so then in the first day we will also connect that part like how the connectivity should be there so whatever you are creating something in your code uh like how it will connect to your your Cloud only and not somebody else's cloud and all in that okay so we will do that authentication authorization connectivity part in that okay and gradually in the first sections uh so terraform plugins we just said so the the plugins are actually the uh the main part which connect to each of the cloud and they they create the resources okay so that the terraform uh plug-in means this one yeah so whenever we saw this okay the providers okay so these providers or plugins both you can use it as a synonymous okay so for example AWS and Azure and all so in my code let's say I want to use a Azure I want to create some Azure resources okay so how terraform knows that okay because it has has to talk to Azure okay so using this part the terraform will download the required plugins okay from Hashi Corp from the vendor from the Hashi Corp on need basis like if I'm going to create resources in Azure it will go and download the the things or the you can say the languages or Plugin whatever it will go and download okay so it is not going to download from awsn all it will only download from Azure okay because I I want to create resources in that similarly if you want to create something in AWS so uh it will using this block of code it will go and download the specific um plugins which it needs to talk to that AWS Cloud okay so whenever whatever code we are writing in terraform it will be kind of a extension with TF okay so naming you can have anything just as a convention I have put it main.tf so for example this code block
okay I'm I want to create some resource uh IM am user resource okay in AWS so this block says Okay I want to I want a provider okay so the provider means these are the actual files the plug-in files which it will download from Hashi Corp okay so when initially like day one when the terraform language created okay kind of 2012 13 that time ear in that time in the binary itself in the terraform executable itself all the capabilities was there okay so whether it has to talk to Azure AWS or anything all the capabilities were there in a single file so gradually it became so bulky that whenever you're running some terraform EG command it it hung for like minutes okay because it gradually became so big because the clouds are changing they're adding capabilities okay so those things needs to be added in the binary so sometime in the initial versions they change that concept of putting everything in a single executable okay the hashar developers thought okay know that that is not the proper way let's break it down into one component which will just read your code and based on whatever you need whatever resource you want to create in whichever Cloud it will go and download that capability okay so uh I can say for example let's say um uh you can say in generic a translation also okay so for example you want to um convey something to a to a different uh in a language okay for example I want to convey something to to a French person like a France so I want to talk in French so I will I will get a translator like who who is capable in communicating in French okay similarly I want keep all the persons in standby okay so let's say I want to talk to somebody else in some other language okay Thum or something so I will get the translator in that language so similarly the thing is happening here so for example I want to create a resource in in AWS so our code when we run it will go and download only those plugins which will be required to talk to AWS okay so that's why your code will be pretty small your binary will be pretty small and it will be very fast to execute okay yeah so our terraform is like kind of a split in two components one is terraform core whatever you will download in your system okay that terraform core executable is there so there are some responsibilities of this component and there are some responsibilities of the plugin okay so the plugin is one which will be downloaded on required on need basis only okay whichever resource and whatever you download it will be created those files will be downloaded in the same folder in a hidden folder called terraform providers okay for example let me see if if I have run some code here here in in the same folder okay so demo class so these are my this is actual my code but in the terraform the providers it will get downloaded okay whenever I run the terraform commands and all these will get downloaded okay so using these files uh the terraform on my local system will talk to the cloud okay for example this one Azure so this is the actual plug-in file okay so you can see here 299 MB quite big size okay so that's why it is now on component so it is as a plugin earlier many years ago when it started everything is was just a single file so it size was like massive okay so now it is um kind of changed in that so this plug-in will help us to communicate to each respective cloud provider and so I said here there are some responsibilities of the core and some responsibilities of the plug-in so what the core does is your core will check um your core will check your uh Main whatever you have written and it will create a dependency map okay like uh because we are not going to tell terraform like how to create in which sequence and all okay for example let's say you want to create a VM uh in in AWS so you need a VPC as well a subnet something you need okay and there should be there will be a sequence correct in in Azure or AWS whenever you're creating resources so your it will read your code it will and it will figure out that how the sequencing should be there and it will create a dependency chart like which resource has to be create first which resource at the end and all this we don't we are not going to tell explicitly in terraform okay so so the core does that part and it creates the dependency graph it also checks your syntax and whatever you're doing wrong in that okay and it also communicates with the plug-in over RPC protocol okay so this is is the high level responsibility of the core component and the plug-in what it does it will plugin will use the API calls because all the cloud uh providers we are talking with the API okay so it will talk to the cloud provider using the API call and who will talk the plugin will talk whatever we downloaded okay so and it will get the resource created uh in that uh respective Cloud okay and the high level workflow for terraform is not not very complex very straightforward okay so not a kind of a hardcore developer job kind of thing you have to know couple of commands mainly day in day out these four commands are are are used heavily okay terraform init these are the commands as well corresponding so first we are initializing so initializing means we are downloading the plugin required to talk to the cloud okay then we are doing a plan like what we don't want to create or destroy whatever you want to do it will just do a plan it won't do anything it will just tell us like this is going to be done then do the apply so you create the resources and finally once you're happy if your job is done you can destroy as well so these are the four commands which are mainly used day in day out there are many other commands which will be used little bit um less frequently okay or on need basis okay which we will also go through those commands Okay and our syntax kind of a block level so for example this one this is a resource block and whatever comes after this block type uh these are called the labels okay the block uh labels and uh this resource block like this this block is type resource and this this is the resource type and this is the name of this block okay and we can use multiple blocks the same way but our this name has to be unique if you are going to create one more instance maybe so we have to ensure that name of this block is unique in our code okay and whatever is here for example Ami equal to this is given I cannot choose on my own okay whatever this part will be okay so this is a pretty fixed part so so this is called uh schema enforced so that means there is a specific way of doing there is a syntax so in this resource in this block I'm only allowed to use these many things okay and even the values also will uh like whatever you are giving through the portal whatever Ami ID is there for in this case you have to give similar way in that okay similarly instance type so this is these are called arguments and this is the uh argument name and this is the argument value okay and we don't need to remember all this stuff so where we we find all this is for example here uh we are going uh let's say anything okay so for example anything anything let's take randomly something so uh whatever we are creating all all the possible things in that block what all are there this is documented here okay so that's why because this is a dynamic environment features keep on changing features are going new features are coming so these all will be changing day in day out okay so if we see how frequent this is so we can check it from here okay so for example this one the AWS uh provider is changed just two days ago then 3 days ago it was published in new version 10 days ago so you see how frequent it is okay how many how much changes are there so this is changing and at the same time your terraform also has to sync with the cloud features because terraform is going to create uh resources in Cloud okay so for if those capabilities are not added in terraform also it will be lagging so everything it is very Dynamic uh in this new way of doing okay so we have to so that's why the remembering part is very less you have to follow the uh possible documentation in that whatever possible things are there okay whatever things you need they give a skeleton code and you can modify on top of it what all things we need okay so for example uh here also in that resource maybe I am user I I don't have to no maybe know for a user there should be some username okay so even if I don't know what I say I will press control and space bar it the intelligence will give me some help in that okay like what things are there so it is it is showing telling here required so this is a mandatory thing I have I have to give some something okay so similarly we can get help like this way this is the this is the first way we can do but maybe your plug-in is not yet completely updated or or in sync maybe this Azure RM version got updated today okay so then in that case you have to go through the documentation and find out maybe some new argument is added okay in last two days which is not showing in in this inter ense okay because each vendor is trying to catch up with each other okay so that's why we have to follow the most updated on so Cloud because we are going to create a resource in Cloud so you have to ensure um we are following the appropriate documentations okay and so in kind of this block way of programming this is our um um type of the resource whatever we are creating and this is our name of this block okay so whatever let's say if down the line we want to refer something in this so we will use this this name okay and these all things are again fixed we cannot change anything on our own I cannot give anything ABC equal to something like that okay because these are fixed it will give error okay and how the commands will be and our course when we do it will be more kind of um 60 40 some or or 60% handson 40% slides will be there okay so for example this one if First Command we do terraform init okay so init what it does this downloads the plugin and all it is a one time we have to do initially because already we see that it's there but there is no problem it can again it will just check if everything is there it's already it will say SL now terraform next one is terraform plan okay so plan will just say us will say what it will go it is going to do okay it is not going to create anything it will just tell okay so this information is very useful uh in production or anywhere okay so you have to be careful while you have to review at least what it is doing maybe it is by mistake it is not destroying anything because this is very small code we are doing but in actual organization and all when we go the code will be multiple files hundreds of lines of code will be there in that okay so once your output is there you have to carefully review it and see that is the intended uh way like whatever you want your intentions are are those getting met or not okay so for in this case we want to create a very simple IM IM user in in a in AWS okay and the imem user name is t 001 I am going okay so this Arn is showing some things because the IDS and all will be dynamically generated once the resource are created so those things it will tell the it will be known after apply so once we create the resource then only these things will be known but your name is already known because we fixed the name here okay so once we are happy with our terraform plan then we do the terraform apply okay so let's uh so this commands we will use day in day out okay so here if you see it is prompting something okay either we are happy again it is giving one more time that okay are we happy with this terraform will perform these actions are we fine so we press yes okay in organizations and all when you do uh code and all you'll put in some pipeline either Azure devops or genkins and all so then this way won't be possible so this will be uh you have to Auto approve it okay so so instead of let me control see it so instead of um somebody typing there yes because it won't be possible in automated way it should be non- interactive okay so we do terraform apply Das Auto Dash approve so it won't prompt me like here it prompted because while testing okay it's fine but in when you're doing a pipeline it should be like this but yeah in our testing we will just do terraform apply just to be sure what all things we are doing is all fine so here it says okay the resource is created and the user super 001 is created so if we go to our if I logged in I am users okay what is the user super 001 okay so this user is now created super 001 okay if we want to know we want to destroy it whatever we are created okay we can do Auto approve as well or just perform destroy it will prompt us and one more thing like uh before destroying I want to show you one we saw the term item potent okay where uh irrespective of number of times you run the code output will be kind of same okay so now the resource is already created so if I again execute the terraform apply and all it it knows that there's nothing to do okay so this is our item potent coming in picture okay the number of times again you run there is nothing because there is no change in in your um your final destination okay so that's why it is saying nothing will happen in that so we are find to destroy it par from destroy so these four commands inet plan apply destroy will be used day in day out you know trial testing everything whatever you want to learning so this will be used okay I'm sorry I did not say yes and uh similarly in day to in day know in in organizations also these four commands will be pretty much will be used every day okay so now this resource is destroyed so I refresh so that resource is gone the super 001 okay okay so uh this way we will be doing these are our four way and in the first class now you saw like how it did the connectivity part and all so we will see that in our actual class in a course how we made it connect this Visual Studio code to the actual uh this my AWS connection okay similarly we can create resource in Azure and it doesn't mean that you can create in this file I can create only AWS yeah you can create many in the same file itself you can create Azure resources as as well okay by giving the uh by giving the corresponding block so whatever we are giving so it can create Azure resources so it will download the corresponding plug-in so in that code it will see what all things we have asked for the providers and it will see whatever resources we are going to create and all and it will download the respective uh providers needed when we do the terraform init okay so this is the complete kind of intro the high level intro and our initial kind of once we are done with the initial blocks like initial things then we will go through the each of the blocks okay and um once we are done with all the blocks uh then we'll do the very important topic which is our variables okay so the variables will come slightly down the line yeah the variables okay so because variables you will use again day in day out in the coding so for example you have to see uh you're creating a a im uh user for in this case Okay so instead of hardcoding the resource here because this will be given by the user okay so we don't have to hardcode this or write it here it will accept it maybe from a user okay or maybe some from other variable or some other way so we will see how to declare these things okay and this is a single string we are storing but many times you have to store a lot of other Associated things maybe for a for example a instance okay instance as a hard disk is there a subnet okay VPC which will be associated in Service Group NSG okay rules so all the things we have to store somewhere okay all these variables so there are different types of variables and uh um they are categorized in primitive collection and structural okay so which are these are one of the core part of in the terraform so once you are aware of the variables then you know like how to best store the information okay so instead of using 10 string variables you can use a map variable okay or use a list variable in that way so we will go through all those uh in the uh in the first topic itself in the first section itself but once your tools or everything is installed then gradually you'll do that okay so yeah this is all the um kind of one hour has passed so this is all the intro which we are going to do and towards the end of the course um uh maybe this it depends like we will see how the the batch members how how capable they are or how quickly they are going and based on that we will slightly relax or go fast the pace we will de Side based on all all the members there and during the course you will also get your homework to do kind of I won't give it a lot of kind of homework but once you learn you will find some interest in doing the resources okay uh so it will it will keep it interactive [Music] and kind of this first this part will will make you kind of create all the resources and start creating the second part is more little bit advaned okay so once the these all four topics are done then you are ready to create all the resources and modules and all that stuff okay so these are kind of extra bit is there and eight and nine are more into the organization part like your day like your actual experience one in the organizations they they do might be terraform Enterprise or cloud and all so this will give a uh kind of look and feel an experience in that way okay and this part will will be integrating that in a full automated way okay so yeah this this is there and hope this you learned something from today's demo class okay so that's all over to Amit to you okay or open for any questions and and search you if you have uh Amit you there uh sorry I can't hear you uh just a moment let me check with just let me check with AIT yeah so yeah one question came from that yeah Loops Maps objects yeah all the things will be covered uh which cloud provider as I said our mainly will be Azure and AWS okay so I I know org or the user some members will be AWS oriented and some will be aure mainly gcp won't be covered okay so but these two okay but once you know terraform it doesn't matter it won't stop you like you can create any anything you in that so once you know how to create the the terraform resource and all okay so then you can create uh any other questions co-pilot no co-pilot uh no this is not there the co-pilot session and all yeah you can use the capabilities for that while coding that's fine some organizations allow some don't due to security issues so yeah you can use that uh intelligence it gives more kind of capabilities in in writing the code okay murug Loops map objects yeah all all the things will be there in that this will come in the variables part okay the maps and objects yeah so very important components uh how about support after the Comm CL will be there uh that will be given by Amit I think yeah Amit will pleas coordinate with Amit like he will do tell on which day and charges based on like how many members which time zones they're doing you will find a Best suitable um time for that okay and in the first session also we will see how uh best we can use the or how quickly or how what will be the pace there then based on that we can do it okay I think thanks all thank you all I think if there no further class no further questions yeah we will close the session Amit over to you thank you
2024-07-03 04:07