A LOOK INTO THE TERRAFORM VARIABLES

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

1.Types of Terraform variable – Number

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  region = "us-west-2"
  access_key = ""
  secret_key = ""
}


variable "numofusers" {
  type = number
  description = "This is for demo of number variable"
  default = 3
}
resource "aws_instance" "first-ec2" {
  ami            = "ami-03d5c68bab01f3496"
  instance_type  = "t2.micro"
}
provider "github" {
  token        = "ghp_mCsNU213nRzomV9xIIQCg4jkS2meo1UAP3H"

}

resource "github_repository" example" {
  name        = "Akshatha Ashwathnarayan"
  description = "My code"

}
 

  Code language: PHP (php)

2.Types of Terraform variable – String.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  region = "us-west-2"
  access_key = ""
  secret_key = ""
}


variable "username" {
  type = string
  description = "This is for demo for string variable"
  default = "user"
}
resource "aws_instance" "first-ec2" {
  ami            = "ami-03d5c68bab01f3496"
  instance_type  = "t2.micro"
}
provider "github" {
  token        = "ghp_mCsNU213nRzomV9xIIQCg4jkS2meo1UAP3H"

}

resource "github_repository" example" {
  name        = "Akshatha Ashwathnarayan"
  description = "My code"


}Code language: PHP (php)
3. Types of Terraform variable – List

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  region = "us-west-2"
  access_key = ""
  secret_key = ""
}


variable "users" {
  type = list
  description = "This is for demo for list variable"
  default = "list"
}
resource "aws_instance" "first-ec2" {
  ami            = "ami-03d5c68bab01f3496"
  instance_type  = "t2.micro"
tags = {
  name        = "Akshatha Ashwathnarayan"

}Code language: PHP (php)
4. Types of Terraform variable – Map

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  region = "us-west-2"
  access_key = ""
  secret_key = ""
}


variable "amis" {
  type = map
  description = "This is for demo for amis variable"
  default = "user"
}
resource "aws_instance" "first-ec2" {
  ami            = "ami-03d5c68bab01f3496"
  instance_type  = "t2.micro"
}
provider "github" {
  token        = "ghp_mCsNU213nRzomV9xIIQCg4jkS2meo1UAP3H"

}

resource "github_repository" example" {
  name        = "Akshatha Ashwathnarayan"
  description = "My code"


}Code language: PHP (php)
5. Types of Terraform variable – Boolean

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  region = "us-west-2"
  access_key = ""
  secret_key = ""
}


variable "set-password" {
  type = string
  description = "This is for demo for boolean variable"
  default = "false"
}

variable "create_vm" {
  description = "If set to true, it will create vm"
   type   = bool
}

variable "create_vmss" {
  description = "If set to true, it will create vmss"
  type = bool
}
resource "aws_instance" "first-ec2" {
  ami            = "ami-03d5c68bab01f3496"
  instance_type  = "t2.micro"
}
provider "github" {
  token        = "ghp_mCsNU213nRzomV9xIIQCg4jkS2meo1UAP3H"

}

resource "github_repository" example" {
  name        = "Akshatha Ashwathnarayan"
  description = "My code"


}Code language: PHP (php)