Exmaple :- Create a EC2 instance if the env is prod
provider”aws” {
region =”us-east-1″
}
variable”env” {
default=”prod”
}
resource”aws_instance””name” {
ami =var.ami
instance_type=var.instance_type
count = “${var.env==”prod” ? 1 :0}”
}
SUBSCRIBE TO GET FULL ACCESS TO THE E-BOOKS FOR FREE 🎁SUBSCRIBE NOW
SUBSCRIBE NOW TO GET FREE ACCESS TO EBOOKS
provider”aws” {
region =”us-east-1″
}
variable”env” {
default=”prod”
}
resource”aws_instance””name” {
ami =var.ami
instance_type=var.instance_type
count = “${var.env==”prod” ? 1 :0}”
}