Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Terraform Tutorials: Variables – Data Type – Number

In this example, the instance_count variable is defined with a type of number, and it is given a default value of 1. The AWS provider is then configured to use the us-west-2 region.

The aws_instance resource is used to launch Amazon EC2 instances. The count argument is set to the value of the instance_count variable, which means that Terraform will launch instance_count number of EC2 instances.

You can change the value of instance_count by modifying the default value in the variable definition, or you can specify a different value when you run Terraform by using the -var flag. For example, if you want to launch 3 instances, you can run the following command:

$ terraform apply -var ‘instance_count=3’

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.