Terraform:

DevOps

MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

A comparison between Ansible Vs Docker Vs Terraform:

Docker is platform as a service whereas terraform and ansible are infrastructure as a service

Ansible is suitable for small, temporary, and fast deployments.

Terraform is better when it comes to managing cloud services below the server.

 Terraform is an open source, IaC platform. Whereas, Ansible is an open source configuration management tool. Developers can use Ansible and Terraform at the same time

Terraform uses HCL,Ansible uses Yaml,Docker uses namespaces ,images

Terraform uses to create resources and services .ansible to configure resourses

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 {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

# Configure the AWS Provider
provider "aws"  {
  region     = "us-west-2"
  access_key = "()"
  secret_key = "()"
}
resource "aws_key_pair" "deployer" {
  key_name   = "deployer-key"
  public_key = "ssh-rsa 
}
resource "aws_security_group" "instance" {
  name = "terraform-example-instance"
  ingress {
    from_port   = 8080
    to_port     = 8080
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
variable "security_group_id" {}

data "aws_security_group" "selected" {
  id = var.security_group_id
}

Code language: PHP (php)