Prerequisites:
>> Install Terraform.
https://developer.hashicorp.com/terraform/install
>> A project in a CloudPe Infrastructure domain.
Ensure that you have the app credentials to access this project.
>> You can refer to the article to Generate Credentials.
>> Your favourite text editor. In this guide, we are using Vim.
Download the given Terraform variables zip on your system zip file
contains the files as shown in the screenshot below
To download sample Terraform script, click here https://content.cloudpe.com/CloudPe-Terraform-sample.zip
There are 3 main important files that you can automate and adjust the variables as per
your requirements
- The terraform.tfvars file is a convenient and secure way to handle sensitive data
required by Terraform for deploying infrastructure.
It helps to separate secrets from your main configuration files and avoids exposing them in version control systems. Always be cautious with secrets and use proper security mechanisms to protect them.
Paste your given app credentials and secret in the file and save it.
2) main.tf is the core configuration file in Terraform, where you define your infrastructure
resources, provider seƫngs, data sources, variables, and outputs.
It enables you to define and manage infrastructure in a declarative manner, which can be
version-controlled and easily reused.
It typically includes configurations for providers, resources, data sources, and outputs.
while also being flexible by using variables for customization.
3) The variables.tf file in Terraform is used to define and manage input variables.
It makes the configuration flexible, reusable, and easily customizable by parameterizing aspects of
Your infrastructure.
How to set the VM count to launch multiple VMs.
1) Open the variables.tf with your text editor
2) Adjust the values for bulk VM deployments as per given screenshot below

3) Run cmd terraform init in your PowerShell or terminal
(This will initialize your working directory and download the necessary providers, modules, and set up the
backend if)

4) Once you adjust the VM count and other variables in step 2, run
Cmd:-
terraform
apply

If all steps are correctly followed, you will get the following confirmation option to
Launch the VMs enter value as yes

Once you give the confirmation as yes, it will show that all the Resources are added.

Final verification with the CloudPe Dashboard.
