But the last command: sudo apt-get update && sudo apt-get install terraform
Gives this:
Ign:1 https://apt.releases.hashicorp.com kali-rolling InRelease
Err:2 https://apt.releases.hashicorp.com kali-rolling Release
404 Not Found [IP: 151.101.86.49 443]
Reading package lists… Done
E: The repository ‘https://apt.releases.hashicorp.com kali-rolling Release’ does not have a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Also, since Terraform itself is just a single executable file, you can just download a binary that supports your distribution, and using a package manager is optional:
If Kali Linux is sufficiently similar to one of the supported distributions then you may be able to change the distribution name in sources.list file or sources.list.d/* file to select one of those instead of kali-rolling instead, but I’m not familiar enough with Kali Linux to say whether that is true and, if so, which of the supported distributions would be most suitable to choose.
As @shohei noted, you can also directly download the main .zip release archives and extract them to get a terraform executable. The APT packages for Terraform on apt.releases.hashicorp.com just wrap that same executable with APT metadata, and so an executable installed in that way should behave identically to one installed using APT.
I came across this article for same issue, installing terraform on Kali Linux WSL. I added below ubuntu package repo in in /etc/apt/sources.list.d/hashicorp.list.