Selfnotes-terraform

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”

}