Installing Terraform by script on Windows
If we use Windows, we can use Chocolatey, which is a free public package manager, such as NuGet or npm, but dedicated to software; it is widely used for the automation of software on Windows servers or even local machines.
The Chocolatey official website is here: https://chocolatey.org/, and its installation documentation is at https://chocolatey.org/install.
Once Chocolatey is installed, we just need to run the following command in PowerShell or in the CMD tool:
choco install terraform -y
The following is a screenshot of the Terraform installation for Windows with Chocolatey:
Executing the choco install terraform command installs the latest version of Terraform from Chocolatey.
Once installed, we can check the Terraform version by running the following command:
terraform version
This command displays the installed Terraform version.
We can also check out the different commands that Terraform offers by running the following command:
terraform --help
The following screenshot lists the different commands and their functions:
Let's now look at the installation of Terraform on macOS.