hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.74k stars 9.56k forks source link

docs: install: fedora: incorrect instructions for `dnf` #35979

Open johnstcn opened 2 days ago

johnstcn commented 2 days ago

Terraform Version

Terraform v1.9.8
on linux_amd64

Affected Pages

https://developer.hashicorp.com/terraform/install#linux

subsection "Fedora"

What is the docs issue?

Current Terraform install command referenced on https://developer.hashicorp.com/terraform/install#linux is:

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

Line 2 returns the following output:

sudo dnf config-manager --add-repo
Unknown argument "--add-repo" for command "config-manager". Add "--help" for more information about the arguments.

What does work for me:

sudo dnf config-manager addrepo --from-repofile=https://rpm.releases.hashicorp.com/fedora/hashicorp.repo

Looks like this was changed between dnf v3 and v5.

The Fedora project docs [1] are inconsistent on this subject and appear to reference both dnf config-manager --add-repo and dnf config-manager addrepo --repo-url

[1] https://docs.fedoraproject.org/en-US/quick-docs/adding-or-removing-software-repositories-in-fedora/#_adding_repositories

Additional information:

Linux 6.11.6-300.fc41.x86_64

$ cat /etc/fedora-release
Fedora release 41 (Forty One)

$ dnf --version
dnf5 version 5.2.6.2
dnf5 plugin API version 2.0
libdnf5 version 5.2.6.2
libdnf5 plugin API version 2.0

Loaded dnf5 plugins:
  name: builddep
  version: 1.0.0
  API version: 2.0

  name: changelog
  version: 1.0.0
  API version: 2.0

  name: config-manager
  version: 0.1.0
  API version: 2.0

  name: copr
  version: 0.1.0
  API version: 2.0

  name: needs_restarting
  version: 1.0.0
  API version: 2.0

  name: repoclosure
  version: 1.0.0
  API version: 2.0

Proposal

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

References

https://github.com/rpm-software-management/dnf5/issues/1537

bschaatsbergen commented 2 days ago

Hi @johnstcn,

Thank you for raising this issue and suggesting a potential solution.

I can replicate the behavior on Fedora Linux 41, which uses DNF5. It appears that DNF4 compatibility was intentionally broken in favor of new sub-commands introduced in DNF5 (https://github.com/rpm-software-management/dnf5/issues/405). This works on Fedora Linux 40, which uses DNF4.

Regarding this change, the documentation on adding a repository appears only partially updated. I’ll submit a pull request to address this.

Since F41 is the latest supported release, we’ll ensure this is fixed on our side as well. Thanks!

bschaatsbergen commented 2 days ago

Cross-reference for a documentation update in the Fedora docs: https://pagure.io/fedora-docs/quick-docs/pull-request/783

johnstcn commented 1 day ago

Thanks for the upstream PRs @bschaatsbergen !

bschaatsbergen commented 1 day ago

Thanks for the upstream PRs @bschaatsbergen !

Thank you for being awesome and letting us know about this!