Terraform Automation using Jenkins | Automate Infrastructure setup using Terraform and Jenkins

preview_player
Показать описание

how to execute Terraform scripts automatically using Jenkins pipeline. We will learn how to create EC2 instance using Terraform and Jenkins in AWS cloud.

Pre-requisites:
Jenkins is up and running
Terraform is installed in Jenkins
Terraform files already created in your SCM.

Step 1 - Create IAM role

Step 2 - Attach IAM role to Jenkins EC2

Step 3 - Create Jenkins pipeline with parameters

Step 4- Execute pipeline
Рекомендации по теме
Комментарии
Автор

Thanks for this tutorial. Followed it step by step and it worked as expected. Thank you. :)

mohitmansi
Автор

Thank you for the tutorial. Can we limit the access for the role (if you have an example that would be great) rather having EC2 Full Access? I'm feeling not comfortable in using 'All access" role.

AmirulAhmad
Автор

@devopscoach, How are you managing the state files after applying a resource? You didnt talk about this point at all which is very important?

alan-j
Автор

Great video, thank you. When building with parameters in Jenkins how can we automate the process for example using github webhooks when we have to choose the actions, like in your example apply or destroy?

vanessamofor
Автор

It's very clear explanation..Sir, also how would we setup build with parameterized job for while provision the services in aws for dev, cert, prod environments? Is it possible to setup both the actions in single pipeline?

thangamdurai
Автор

Fantastic Tutorials. My initial thought of this workFlow is that we are using IaC {{ Terraform }}to build infrastructure .Why Don't we build every resource using Terraform including the EC2 hosting Jenkins

mbomboaimaim
Автор

can anyone please help me to understand ( assume terraform code is ready for one region)
1> Can we use different name (e.g. envjenkinfile ) ?
2> what is the best way to deploy multi region infrastructure with jenkins ( create separate jenkinfile or same ? create separate jobs or same job ? )
3> create separate git branch or just create separate tvars folder ?

pngmors
Автор

Nice tutorial but I just want to ask you one thing about the Use Case of this integration.
As we can create an ec2 using terraform by simply provisioning the infrastructure then why doing integration with Jenkins.
Could you please provide me the actual Use Case of this integration?
Thanks.

mdnishadhussain
Автор

Hi! Where do you store the Terraform state file after it has been deployed in Jenkins?

kyleatendido
Автор

sir how to access the ec2 instance created by the terraform as we dont have the key to attach?

rohanrustagi
Автор

pls add "--no-color" to your terraform execution line

freemangh
Автор

Hi nice video,
I just started learning devops,
I have a question that how Jenkins comes to know to read terraform file only and execute the code?
An application can have n no of file like .java, .text etc how it will choose only terraform files ?

rahimkhan-fhdd
Автор

This is real case like this do pipeline

UniqueUnique
Автор

hi, if my jenkins in my local machine. then how it will connect to aws and it will create ec2

sivakumarchodavarapu