Terraform installation error "Status code: 404 for https://rpm.releases.hashicorp.com//hashicorp.repo"

Below error is generated when installing terraform from official documentation.
sudo yum-config-manager — add-repo https://rpm.releases.hashicorp.com/$release/hashicorp.repo

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd

adding repo from: https://rpm.releases.hashicorp.com//hashicorp.repo

grabbing file https://rpm.releases.hashicorp.com//hashicorp.repo to /etc/yum.repos.d/hashicorp.repo

Could not fetch/save url https://rpm.releases.hashicorp.com//hashicorp.repo to file /etc/yum.repos.d/hashicorp.repo: [Errno 14] HTTPS Error 404 — Not Found

Error is generated because of the value of the release variable in the URL is null.
echo $release

Set the release value as “RHEL” for RedHat and Centos and “AMAZONLINUX” for Amazon Linux AMI

Execute below to find if the value is set.

[root@sirjoon ~]# echo $release

RHEL

  1. Now run the command and the repo will be configured.

[root@sirjoon ~]# yum-config-manager — add-repo https://rpm.releases.hashicorp.com/$release/hashicorp.repo

Updating Subscription Management repositories.

Adding repo from: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo

This should be fixed in official documentation.

Hi @sirjoon!

The documentation you linked to seems to already discuss that $release is a placeholder to be replaced with the distribution release name:

Before adding a repository you must determine which distribution you are using. The following command lines refer to a placeholder variable $release which you must replace with the appropriate value from the following list:

It looks like you originally attempted to use the command lines literally, without replacing $release with one of the listed keywords. You then set $release as an environment variable, which made it possible to evaluate the command line literally because the shell itself handled the replacement then.

Is that true? I’m trying to understand what exactly you’re suggesting to change in the documentation, because it seems like the documentation already describes the situation. Can you say a little more about what you are proposing? Thanks!