This guide will help you to Install Terraform on Fedora 35/34/33/32/31. Terraform is a cloud-agnostic Infrastructure automation tool used to manage cloud and on-premise resources. Terraform can build, change, and version infrastructure deployed on popular service providers.
With Terraform you can manage Cloud Compute, Networking, Load Balancers, DNS and so on using simple Declarative Programming Language. See the complete list of Terraform Providers.
There are two methods from which we can install terraform on Fedora35/34/33/32/31. We will cover terraform installation on our Fedora system from YUM repository and manual installation.
Method 1: Install Terraform from YUM repository
Terraform development team provides package repositories for RedHat Enterprise Linux based Linux distributions such as Fedora, CentOS, Rocky Linux and Amazon Linux systems.
Add HashiCorp repository to your system by running the following commands:
sudo dnf install -y dnf-plugins-core sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
Confirm that the repo was added successfully to the system:
$ sudo dnf repolist repo id repo name fedora Fedora 35 - x86_64 fedora-cisco-openh264 Fedora 35 openh264 (From Cisco) - x86_64 fedora-modular Fedora Modular 35 - x86_64 hashicorp Hashicorp Stable - x86_64 updates Fedora 35 - x86_64 - Updates updates-modular Fedora Modular 35 - x86_64 - Updates
Finally install terraform package on Fedora 35/34/33/32/31/30 Linux system:
sudo dnf install terraform
Review dependency tree and proceed with the installation:
Dependencies resolved. ====================================================================================================================================================================================================== Package Architecture Version Repository Size ====================================================================================================================================================================================================== Installing: terraform x86_64 1.0.11-1 hashicorp 12 M Installing dependencies: openssl x86_64 1:1.1.1l-2.fc35 fedora 659 k Transaction Summary ====================================================================================================================================================================================================== Install 2 Packages Total download size: 13 M Installed size: 57 M Is this ok [y/N]: y
Validate successful installation of Terraform on Fedora by checking the verison:
$ terraform --version Terraform v1.0.11 on linux_amd64
Method 2: Manual installation of Terraform on Fedora
Terraform primary distribution method is a .zip archive which contains single executable file that you can extract and run on your system. You can check the latest release on Terraform releases page before downloading below.
Install wget and curl tools on your Fedora:
sudo dnf install wget curl
Then download the latest release of Terraform in .zip archive format.
TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \"\,\v | awk '$1=$1;1'` wget https://releases.hashicorp.com/terraform/$TER_VER/terraform_$TER_VER_linux_amd64.zip
After the download, extract the archive:
$ unzip terraform_$TER_VER_linux_amd64.zip Archive: terraform_xxxx_linux_amd64.zip inflating: terraform
Move terraform binary to /usr/local/bin directory:
sudo mv terraform /usr/local/bin/
This will make the tool accessible to all user accounts.
$ which terraform /usr/local/bin/terraform
Confirm the version installed
$ terraform --version Terraform v1.0.11 on linux_amd64
Verify that the tool works:
$ terraform Usage: terraform [global options]
[args] The available commands for execution are listed below. The primary workflow commands are given first, followed by less common or more advanced commands. Main commands: init Prepare your working directory for other commands validate Check whether the configuration is valid plan Show changes required by the current configuration apply Create or update infrastructure destroy Destroy previously-created infrastructure All other commands: console Try Terraform expressions at an interactive command prompt fmt Reformat your configuration in the standard style force-unlock Release a stuck lock on the current workspace get Install or upgrade remote Terraform modules graph Generate a Graphviz graph of the steps in an operation import Associate existing infrastructure with a Terraform resource login Obtain and save credentials for a remote host logout Remove locally-stored credentials for a remote host output Show output values from your root module providers Show the providers required for this configuration refresh Update the state to match remote systems show Show the current state or a saved plan state Advanced state management taint Mark a resource instance as not fully functional test Experimental support for module integration testing untaint Remove the 'tainted' state from a resource instance version Show the current Terraform version workspace Workspace management Global options (use these before the subcommand, if any): -chdir=DIR Switch to a different working directory before executing the given subcommand. -help Show this help output, or the help for a specified subcommand. -version An alias for the "version" subcommand.
Now that you have Terraform installed, it is time to build infrastructure using a minimal Terraform configuration file. Terraform Use Cases is an interesting page to read.
Other installation guides:
For Ubuntu use:
Windows guys can follow Install and Use Terraform on Windows / Windows Server