CICD-Jenkins-Terraform-Integration (writing IAC and Jenkinks PIpeline)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi hello welcome to vishwa tech so today the session is ci cd with jenkins and again terraform integrating jenkins integrating telephone plugin into the jenkins and again writing at home scripts providers variables main configuration files and i can fully see icd automating with pipeline as a code with the declaration tags infrastructure has a code with craft with one click deployment from jenkins need to create infrastructure from terraform like vpc extra bucket vpc s3 package so that's what so okay the first thing we need to understand that how to integrate the reform to the jenkins the first thing we need to go for jenkins server yes i mean this is jenkins node so go to manage jenkins manage plugins click on manage begins we need to add the plugin go to available section add that reform plugin create terraform what is it's a provisioning tool it is a open source and you can install without restart like this is the plugin we are adding after adding this so in the jenkins master node we need to install terraform not only hiding the plugin is not sufficient we need to install the terraform go to [Music] we will click on this terraform perform yes go to download perform download cli depending upon the instances okay so meanwhile whether yes plugin was installed go to dashboard yes right now it is installed go to manage jenkins global tool configurations we need to set the environments so we thought so this terraform terraform is added but we need to install the environmental variables all right so we need to cancel this first we need to install the window around the variables this is a jenkins monster node go to terraform copy this link coupling cutters sudo double gate download this let's package this downloader unzip it unzip terraform yes unzipped unless yes okay see right now terraform so we cannot be able to run this command because we need to set the environmental variables in linux so just you need to copy this sudo move you can use the move command or else copy command anything okay so what you can find out is this so basically cd terraform hold on the binaries we need to set here sudo remove terraform data from user bin yes next you can see this switch terraform yes this is the path you need to take this path use that bin copy this come back to global tool configurations we need to set the enrollments here terraform make sure it's properly terraformed and you can use that beneath the path and you can apply it save it done this is the first configurations we need to do yes so we need to add the plugin also and again we need to install the terraform in our jenkins server also so where we can run this terraform command yes all right so this is one thing now we need to understand terraform cycle forester from bicycle terraform life cycle that is similar to maven lifecycle so terraform in it it will ensure the third party begins which is the provider data from terraform terraform reform so this is the default type second so we need to understand how it works here so in the previous session we understood that what is lifecycle just performance in it is something that is initializing the providers plugins format is anything but whatever the script we have written it with autoformat validate the existing scripts will be validating your plan it is that right and concept which is the script is available apply it will be applying the infrastructure where it will be created and again if you don't want just we can distract that's help of this data from this chai command all right so quickly we can go with like in jenkins so we can create a new job all right so we can write a pipeline script here so take this devops pipeline terraform yes perform click on pipeline so right now we are doing this pipeline job click on this okay all right so just it is taking some time okay why a job already existed yes all right plate click on this job go to configure write a pipeline script all righty by plane skips where we can write a purple step here yes pipeline agent any stages agent any first we need to understand the tools here the tool system is what terraform terraform is a tool so and again you can make some terraform so this is important and again click on this meshes stages this stage check out from gate because all my terraform scripts is available in this repository so this is a provider provider is in simultaneous this is a region and again this is access key and again this is a secret access key and come back to your this is a provider and again now variables so this is what we made it in variables folder like variable access key and again this is the key i've given secret access key yes and again the region so that's why in provider just added where dot access underscore key where that secret underscore key where dart region so this is what completely variables file we differentiated because variables we need to differentiate in one folder one file and again the task should be in one file and again provider should be one file if it's aws this is one provider like this multiple providers like provider azure provider gcp we can add it like multiple providers in the same file the same thing in the same variables while we can edit multiple sections all right so right now just we need to understand this code need to clone to the jenkins master and then from this master we need to create an infrastructure just we need to understand what is the vpc here click on vpc from script yes this is a resource aws underscore vpc this is an emailing conversion just we are given the demo and again cidl 70.17.0.0.16 this is a cdr i have creating again aws underscore subnet demo one subnet one like subnet two and again internet gateway and again route table this is like completely and i am attaching this internet gateway to the public route table this is what completely end-to-end vpc script and again after this we see this infested need to be created this and against the bucket this extra bucket should need to be created this is what through it should be helpful from the jenkins so extra bucket resource and again tags handing in the bucket name the case access control is private our public okay come back these are scripts you should need to clone to the jenkins master from this jenkins master it should create enrollment so this is a vpc right now just refresh this we don't we do have like only one vpc setup here this is a default vpc and again they know there is no package here it should create a bucket there is no bucket it's empty and come back write descript tools get download kit okay take this this code copy this code go back to this pipeline syntax generator and you can add dear gate this is what the repository url the branch is main branch main branch and again my username is codepipe and again the password already i have given just generate your pipeline syntax copy the syntax go back to this this next year steps first step is done successfully cloning the environment okay fine next stage two what is the platform life cycle data form a need the first thing we need to configure it next here we need to write actual script special commands we can run this like this shell form terraform in it this is a stage one i mean stage one steps [Applause] this is the first life cycle next stage two next i want to do data form terraforming script steps click on this search shell commands data form format yes stage it will autoformat the scripts okay steps yes shh perform format terraform validate the script stage steps sh terraform so the syntax error should be more to your full terraform plan right and should need to run your telephone plan and again stage and steps ch terraform this argument we need to pass apply it save it so this simple script yes build now simple let's go with generating we can click on this white spelling you can click on this build yeah hold on just a moment line number 23 23 28 29 26 okay great adjacent acceleration in stage stage great click on configure it is a slowness because configure configure configure yes so the reason is basically discuss the reason is basically turf amount it is done see just need to have this one here in this case system is too slow okay we need to write the script like this like this you just need to add it if you want you can add it unless here we can give any naming connections just close it same thing same thing here also terraform apply here also terraform this is syntax error now it is everything is clear save it apply and you can see just run go to this job run it build two the job is running yeah job is running here just click on this it'll show the complete list from the execution see declarative tool check out from gate stage by stage so this is what the completely how we need to integrate terraform to the jenkins so we had a terror from plugging into jenkins and again in the jenkins master node we need to install terraform so that there are form commands we need to set the environmental variables okay just click on this right yeah see therefore we need format it is validating the scripts so success now it is created the completely infrastructure this is what completely code so from out of format all right so this is myself i'm created with and this is user for me it is a command which ran and this is what the configuration we needed and you can telephone format it is autoformatted validated and you can telephone plan it is a execution plan has been generated as shown below this is one thing completely private or double public routable entrant gateway is attached and again created extra bucket also yeah from auto yeah created extra bucket also creation complete after distance so click on this this is what the complete command it shows like this this is complete full fledge like this so now we need to verify that where we need to verify it we need to verify by going this vpc just click on refresh button so the new vpc should be created yes demo vpc earlier it was only the default vpc now it is created demo vpc and again two submits and again route table that is created two subnets yes subnet 172 and again route tables this machine is a routable underground internet gateway this internet gateway is mass so let's get it and you can go to history management it should be created one bucket let's just refresh it yes the bucket is created here yes my terraform bucket with massive prince bucket so this is what how we need to integrate terraform scripts to the jenkins and you can write in the pipeline scripts this is what we did each year so performing it from font term validated from plant and formula this is what in coming next sessions we can go with like in-depth and again more advanced to deploy the lm package manager or to reply the deployment of primal files into the kubernetes we can see this so thank you thank you everyone thanks a lot please subscribe my channel thank you
Info
Channel: Vishwa-Tech
Views: 2,571
Rating: 4.8974357 out of 5
Keywords:
Id: UEhXp6J4gTg
Channel Id: undefined
Length: 20min 1sec (1201 seconds)
Published: Fri Mar 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.