Choosing Provider, region, machine type, instance type, no of instances, vpc.
terraform init ---> The terraform init command initializes a working directory containing Terraform configuration files.
terraform plan ----> Reviewing Plans
terraform apply ----> Applying them
terraform destroy --->Destroying and preview the changes in terraform
provider "aws" {
region = "ap-northeast-1"
}
resource "aws_vpc" "example" {
cidr_block = "10.0.0.0/16"
}
resource "aws_instance" "ec2" {
ami = "ami-06323ff1c3178cee1"
instance_type = var.list[3]
tags = {
name = "Windows_Server-${count.index}"
}
count = 5
}
variable "list" {
type = list(any)
default = ["m5.large", "m5.xlarge", "t2.medium", "t2.mirco"]
}
variable "types" {
type = map(any)
default = {
ap-south-1 = "t2.micro"
us-west-2 = "t2.nano"
ap-northeast-1 = "t2.micro"
us-west-1 = "t2.small"
}
}