terraform icon indicating copy to clipboard operation
terraform copied to clipboard

Red Hat 8.6 - failing to install TF ( 404 errors)

Open paulczar opened this issue 1 year ago • 8 comments

Terraform Version

cannot install terraform

Terraform Configuration Files

...terraform config...

Debug Output

$ sudo yum install -y yum-utils
Last metadata expiration check: 0:21:16 ago on Tue Mar 21 13:38:56 2023.
Package yum-utils-4.0.21-11.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
$ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
Adding repo from: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
$ sudo yum -y install terraform
Hashicorp Stable - x86_64                                              1.7 kB/s | 313  B     00:00
Errors during downloading metadata for repository 'hashicorp':
  - Status code: 404 for https://rpm.releases.hashicorp.com/RHEL/8.6/x86_64/stable/repodata/repomd.xml
(IP: 18.160.46.37)
Error: Failed to download metadata for repo 'hashicorp': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

Expected Behavior

terraform should install

Actual Behavior

terraform does not install.

Steps to Reproduce

deploy RHEL 8.6

run install commands.

Additional Context

No response

References

No response

paulczar avatar Mar 21 '23 14:03 paulczar

Hi @paulczar,

The installation instructions and the hashicorp.repo file are expecting the $releasever substitution variable to be just "8" (major version) rather than "8.6" (minor version), which seems to disagree with the behavior on your system.

In the hashicorp.repo file there is a template like this:

baseurl=https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable

...and on systems where these instructions were tested, $releasever was 8 rather than 8.6, thereby generating a correct URL:

https://rpm.releases.hashicorp.com/RHEL/8/x86_64/stable/repodata/repomd.xml

I'm not sure what causes your system to behave differently than the ones where these instructions were prepared, but I suspect you could make this work by finding the relevant file under /etc/yum.repos.d which was created by running yum-config-manager and editing the URL to include just 8 instead of 8.6 in the version portion.

Can you give that a try and let me know if it worked?

I'd still like to understand what makes this behave differently on your system but my first priority is to get you a working configuration so you can install Terraform.

apparentlymart avatar Mar 21 '23 15:03 apparentlymart

The instructions on https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli are what I followed which are slightly different to what you are providing here.

paulczar avatar Mar 23 '23 16:03 paulczar

@paulczar Correct. The implication is that either your system in configured in a non-standard way, or our instructions are incorrect. After doing a bunch of web searching, I am not sure which it is; however, https://github.com/hashicorp/terraform/issues/32899#issuecomment-1478105847 should at least get you to the point that you can install terraform without changing your system's default configuration.

crw avatar Mar 23 '23 22:03 crw

Ran into the same issue on two RHEL7 machines (i know, i know) last night. Nothing had changed on the machines or the .repo file since terraform was last updated and it failed on $releasever until I hard-coded "7".

jbroome avatar Jan 11 '24 16:01 jbroome

I have same issue on fedora 37:

Errors during downloading metadata for repository 'hashicorp':
  - Status code: 404 for https://rpm.releases.hashicorp.com/fedora/37/x86_64/stable/repodata/repomd.xml (IP: 18.245.143.105)
Error: Failed to download metadata for repo 'hashicorp': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

bushjames avatar Feb 05 '24 17:02 bushjames

I created a file in the path /etc/yum.repos.d:

[hashicorm-repo]
name=Hashicorp Repo
enabled=1
baseurl=https://rpm.releases.hashicorp.com/RHEL/8/x86_64/stable
gpgcheck=0

It helped me.

text-adi avatar Feb 06 '24 18:02 text-adi

Same here. More than likely Hashicorp removed the '7Server' directory/symlink from the yum repository pathing.

The YUM repo needs to be fixed.

bschonec avatar Feb 07 '24 13:02 bschonec

I'm back because my February patching is failing.

here's what I'm getting from Satellite:

https://rpm.releases.hashicorp.com/RHEL/**7Server/**x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

jbroome avatar Feb 15 '24 01:02 jbroome

@jbroome the reason your patches are failing is because the Hashicorp YUM repository no longer has the paths necessary for 7Server, 8Server, etc. Their documentation is wrong, too.

bschonec avatar Feb 16 '24 13:02 bschonec

I'm well aware, I was hoping that hash would have fixed this simple issue by now.

I pushed out a corrected repo file with 7 hardcoded, but it's pretty disappointing that I had to.

jbroome avatar Feb 16 '24 13:02 jbroome

@bschonec please let me know which documentation needs to be updated.

This is the currently the officially supported behavior per the release management team, please see: https://www.hashicorp.com/blog/announcing-the-linux-package-archive-site

And https://www.hashicorp.com/official-packaging-guide:

Note: The provided repository configuration covers the supported distributions listed above. If you are using a variant not listed, you are encouraged to modify the repository configuration to suit your needs. For example, users of RHEL 7Server or RHEL 8.3 can change the baseurl to use 7 or 8 respectively in place of the $releasever variable.

As this is the case, I will close this issue. Thanks for your feedback in this thread, it has been relayed to the team.

crw avatar Feb 20 '24 19:02 crw

sudo dnf install -y dnf-plugins-core
sudo dnf config-manager -y --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo -y
sudo dnf -y install terraform

Or:

CURRENT_VERSION="$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')/terraform_$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')"
curl --silent --output /tmp/terraform.zip "$(echo "https://releases.hashicorp.com/terraform/${CURRENT_VERSION}_linux_${ARCH}.zip")"
sudo unzip /tmp/terraform.zip -d /usr/local/bin
sudo chmod +x /usr/local/bin/terraform
terraform --version || terraform version
rm /tmp/terraform.zip

mbana avatar Mar 09 '24 06:03 mbana

@crw, I tried again and now the repositories are working properly for '7Server' on RHEL7. Perhaps the back-end repository at:

[hashicorp]
name=Hashicorp Stable - $basearch
baseurl=https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://rpm.releases.hashicorp.com/gpg

was fixed by adding '7Server' directory (which was missing previously).

bschonec avatar Apr 08 '24 11:04 bschonec

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar May 09 '24 02:05 github-actions[bot]