πŸš€ DevOps Certified Professional
πŸ“… Starting: 1st of Every Month 🀝 +91 8409492687 | 🀝 +1 (469) 756-6329 πŸ” Contact@DevOpsSchool.com

Selfnotes-terraform

DevOps

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Write a comparison between Ansible Vs Docker Vs Terraform

Terraform Ansible D

Tool categoryOrchestrationConfiguration management
ApproachImmutable infrastructureMutable infrastructure
LanguageDeclarativeImperative
ProvisioningSpecializes in infrastructure provisioningLimited support for infrastructure provisioning
LIfecycle managementLifecycle aware.  Maintains state of deployments.No lifecycle awareness
Command line operationYesYes
AgentlessYesYes

Docker

Tool category Storage/Volume Management ,Orchestration and Schedulers

Approach Mutable infrastructure

Language Declarative

Provisioning Specializes in infrastructure provisioning

LIfecycle management created, running, deleted, paused ,stopped

Command line operation Yes

Agentless Yes

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-

Write a terraform script where you create a linux ec2 instance with Security group and key defined so you should be able to use key to login to ec2 instance.

terraform{

Required_Providers {

linux ec2 instance ={

source = β€œhashicorp/linux ec2” version = β€œ~>3.27 β€œ

}

}

provider β€œlinux” {

profile = β€œAbhishek”

region = β€œus-west-2”

access_key = ” ” secret_key = ” β€œ

}

resource β€œlinux_security_group ” allow key to login”{

name = β€œdevopsschool”

description = ” allow key to login ec2 instance”

}