{"id":5091,"date":"2026-03-21T19:12:17","date_gmt":"2026-03-21T16:12:17","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=5091"},"modified":"2026-03-21T19:12:18","modified_gmt":"2026-03-21T16:12:18","slug":"install-terraform-fedora","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/install-terraform-fedora\/","title":{"rendered":"How To Install Terraform on Fedora 42"},"content":{"rendered":"\n<p>Terraform is an open-source infrastructure as code (IaC) tool by HashiCorp that lets you define, provision, and manage cloud and on-premise resources using declarative configuration files. It supports all major cloud providers &#8211; AWS, Azure, GCP, Hetzner, DigitalOcean &#8211; along with hundreds of other <a href=\"https:\/\/registry.terraform.io\/browse\/providers\" target=\"_blank\" rel=\"noreferrer noopener\">providers<\/a>.<\/p>\n\n\n\n<p>This guide covers how to install Terraform on Fedora 42 using the official HashiCorp DNF repository. We also include a basic usage example to get you started with your first Terraform project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A system running Fedora 42<\/li>\n\n\n\n<li>sudo or root access<\/li>\n\n\n\n<li>Internet connectivity to reach HashiCorp package repositories<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Add the HashiCorp Repository<\/h2>\n\n\n\n<p>HashiCorp maintains an official DNF repository for Fedora and other RPM-based distributions. Start by installing the <code>dnf-plugins-core<\/code> package that provides the <code>config-manager<\/code> command, then add the repository.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y dnf-plugins-core\nsudo dnf config-manager addrepo --from-repofile=https:\/\/rpm.releases.hashicorp.com\/fedora\/hashicorp.repo<\/code><\/pre>\n\n\n\n<p>Verify the repository was added:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf repolist | grep hashicorp<\/code><\/pre>\n\n\n\n<p>You should see <code>hashicorp<\/code> listed in the output, confirming the repository is active.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Terraform on Fedora 42<\/h2>\n\n\n\n<p>With the repository in place, install Terraform directly through DNF. This method handles updates automatically when you run system updates.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y terraform<\/code><\/pre>\n\n\n\n<p>Verify the installation by checking the version:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">terraform --version<\/mark>\nTerraform v1.14.7\non linux_amd64<\/code><\/pre>\n\n\n\n<p>At the time of writing, the latest stable release is Terraform 1.14.7. You can check the <a href=\"https:\/\/github.com\/hashicorp\/terraform\/releases\" target=\"_blank\" rel=\"noreferrer noopener\">Terraform releases page<\/a> for newer versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Enable Tab Completion (Optional)<\/h2>\n\n\n\n<p>Terraform supports shell tab completion for subcommands and flags. Enable it for your current shell:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform -install-autocomplete<\/code><\/pre>\n\n\n\n<p>Restart your shell or source your profile for the change to take effect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>source ~\/.bashrc<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Basic Terraform Usage Example<\/h2>\n\n\n\n<p>To confirm everything works, create a simple Terraform project that uses the <code>local_file<\/code> resource to generate a file on your system. This demonstrates the core Terraform workflow &#8211; init, plan, and apply &#8211; without needing any cloud credentials. If you already manage infrastructure with tools like <a href=\"https:\/\/computingforgeeks.com\/install-latest-packer-on-linux-freebsd-macos-windows\/\" target=\"_blank\" rel=\"noreferrer noopener\">Packer<\/a>, Terraform fits naturally into the same provisioning pipeline.<\/p>\n\n\n\n<p>Create a project directory and a configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p ~\/terraform-demo && cd ~\/terraform-demo<\/code><\/pre>\n\n\n\n<p>Create the main configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi main.tf<\/code><\/pre>\n\n\n\n<p>Add the following configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform {\n  required_providers {\n    local = {\n      source  = \"hashicorp\/local\"\n      version = \"~> 2.5\"\n    }\n  }\n}\n\nresource \"local_file\" \"example\" {\n  content  = \"Hello from Terraform on Fedora 42!\\n\"\n  filename = \"${path.module}\/hello.txt\"\n}<\/code><\/pre>\n\n\n\n<p>Initialize the project to download the required provider plugin:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform init<\/code><\/pre>\n\n\n\n<p>Preview the changes Terraform will make:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform plan<\/code><\/pre>\n\n\n\n<p>The plan output shows that Terraform will create one resource &#8211; the <code>local_file.example<\/code> file. Apply the configuration to create the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform apply -auto-approve<\/code><\/pre>\n\n\n\n<p>Verify the file was created:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">cat hello.txt<\/mark>\nHello from Terraform on Fedora 42!<\/code><\/pre>\n\n\n\n<p>To tear down the resource and clean up:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform destroy -auto-approve<\/code><\/pre>\n\n\n\n<p>This same workflow applies to real infrastructure. You can <a href=\"https:\/\/computingforgeeks.com\/deploy-vm-instances-on-hetzner-cloud-with-terraform\/\" target=\"_blank\" rel=\"noreferrer noopener\">deploy VM instances on Hetzner Cloud with Terraform<\/a> or <a href=\"https:\/\/computingforgeeks.com\/how-to-provision-vms-on-kvm-with-terraform\/\" target=\"_blank\" rel=\"noreferrer noopener\">provision VMs on KVM with Terraform<\/a> using the same init, plan, apply cycle.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Useful Terraform Commands<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>terraform init<\/code><\/td><td>Initialize a working directory and download providers<\/td><\/tr><tr><td><code>terraform plan<\/code><\/td><td>Preview changes before applying<\/td><\/tr><tr><td><code>terraform apply<\/code><\/td><td>Apply changes to create or update resources<\/td><\/tr><tr><td><code>terraform destroy<\/code><\/td><td>Destroy all managed resources<\/td><\/tr><tr><td><code>terraform fmt<\/code><\/td><td>Format configuration files to canonical style<\/td><\/tr><tr><td><code>terraform validate<\/code><\/td><td>Check configuration syntax and consistency<\/td><\/tr><tr><td><code>terraform state list<\/code><\/td><td>List all resources in the state file<\/td><\/tr><tr><td><code>terraform output<\/code><\/td><td>Display output values from the state<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Terraform is now installed on Fedora 42 from the official HashiCorp repository, which keeps it updated through standard DNF operations. The init-plan-apply workflow shown here applies to any provider &#8211; from local files to full cloud deployments across AWS, Azure, or GCP. For production use, store your state file remotely (S3, Terraform Cloud, or Consul) and use version-controlled configuration repositories. Terraform also works on <a href=\"https:\/\/computingforgeeks.com\/how-to-install-terraform-on-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">other Linux distributions<\/a> if you manage mixed environments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Terraform is an open-source infrastructure as code (IaC) tool by HashiCorp that lets you define, provision, and manage cloud and on-premise resources using declarative configuration files. It supports all major cloud providers &#8211; AWS, Azure, GCP, Hetzner, DigitalOcean &#8211; along with hundreds of other providers. This guide covers how to install Terraform on Fedora 42 &#8230; <a title=\"How To Install Terraform on Fedora 42\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/install-terraform-fedora\/\" aria-label=\"Read more about How To Install Terraform on Fedora 42\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":5094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,329,299,50],"tags":[212,761,559],"class_list":["post-5091","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fedora","category-automation","category-how-to","category-linux-tutorials","tag-automation","tag-iac","tag-terraform"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/5091","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=5091"}],"version-history":[{"count":1,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/5091\/revisions"}],"predecessor-version":[{"id":163156,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/5091\/revisions\/163156"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/5094"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=5091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=5091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=5091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}