@fredlackey/devutils 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
- package/src/commands/install.js +374 -36
- package/src/installs/adobe-creative-cloud.js +527 -25
- package/src/installs/adobe-creative-cloud.md +605 -0
- package/src/installs/appcleaner.js +303 -26
- package/src/installs/appcleaner.md +699 -0
- package/src/installs/apt-transport-https.js +390 -0
- package/src/installs/apt-transport-https.md +678 -0
- package/src/installs/atomicparsley.js +624 -26
- package/src/installs/atomicparsley.md +795 -0
- package/src/installs/aws-cli.js +779 -26
- package/src/installs/aws-cli.md +727 -0
- package/src/installs/balena-etcher.js +688 -26
- package/src/installs/balena-etcher.md +761 -0
- package/src/installs/bambu-studio.js +912 -26
- package/src/installs/bambu-studio.md +780 -0
- package/src/installs/bash-completion.js +554 -23
- package/src/installs/bash-completion.md +833 -0
- package/src/installs/bash.js +399 -26
- package/src/installs/bash.md +993 -0
- package/src/installs/beyond-compare.js +585 -26
- package/src/installs/beyond-compare.md +813 -0
- package/src/installs/build-essential.js +511 -26
- package/src/installs/build-essential.md +977 -0
- package/src/installs/ca-certificates.js +618 -0
- package/src/installs/ca-certificates.md +937 -0
- package/src/installs/caffeine.js +490 -26
- package/src/installs/caffeine.md +839 -0
- package/src/installs/camtasia.js +577 -25
- package/src/installs/camtasia.md +762 -0
- package/src/installs/chatgpt.js +458 -26
- package/src/installs/chatgpt.md +814 -0
- package/src/installs/chocolatey.js +447 -0
- package/src/installs/chocolatey.md +661 -0
- package/src/installs/chrome-canary.js +472 -26
- package/src/installs/chrome-canary.md +641 -0
- package/src/installs/chromium.js +645 -26
- package/src/installs/chromium.md +838 -0
- package/src/installs/claude-code.js +558 -26
- package/src/installs/claude-code.md +1173 -0
- package/src/installs/curl.js +361 -26
- package/src/installs/curl.md +714 -0
- package/src/installs/cursor.js +561 -26
- package/src/installs/cursor.md +970 -0
- package/src/installs/dbschema.js +674 -26
- package/src/installs/dbschema.md +925 -0
- package/src/installs/dependencies.md +435 -0
- package/src/installs/development-tools.js +600 -0
- package/src/installs/development-tools.md +977 -0
- package/src/installs/docker.js +1010 -25
- package/src/installs/docker.md +1109 -0
- package/src/installs/drawio.js +1001 -26
- package/src/installs/drawio.md +795 -0
- package/src/installs/elmedia-player.js +328 -25
- package/src/installs/elmedia-player.md +556 -0
- package/src/installs/ffmpeg.js +870 -25
- package/src/installs/ffmpeg.md +852 -0
- package/src/installs/file.js +464 -0
- package/src/installs/file.md +987 -0
- package/src/installs/gemini-cli.js +793 -26
- package/src/installs/gemini-cli.md +1153 -0
- package/src/installs/git.js +382 -26
- package/src/installs/git.md +907 -0
- package/src/installs/gitego.js +931 -26
- package/src/installs/gitego.md +1172 -0
- package/src/installs/go.js +913 -26
- package/src/installs/go.md +958 -0
- package/src/installs/google-chrome.js +801 -25
- package/src/installs/google-chrome.md +862 -0
- package/src/installs/gpg.js +412 -73
- package/src/installs/gpg.md +1056 -0
- package/src/installs/homebrew.js +1015 -26
- package/src/installs/homebrew.md +988 -0
- package/src/installs/imageoptim.js +950 -26
- package/src/installs/imageoptim.md +1119 -0
- package/src/installs/installers.json +2297 -0
- package/src/installs/jq.js +382 -26
- package/src/installs/jq.md +809 -0
- package/src/installs/keyboard-maestro.js +701 -26
- package/src/installs/keyboard-maestro.md +825 -0
- package/src/installs/latex.js +771 -26
- package/src/installs/latex.md +1095 -0
- package/src/installs/lftp.js +338 -26
- package/src/installs/lftp.md +907 -0
- package/src/installs/lsb-release.js +346 -0
- package/src/installs/lsb-release.md +814 -0
- package/src/installs/messenger.js +829 -26
- package/src/installs/messenger.md +900 -0
- package/src/installs/microsoft-office.js +550 -26
- package/src/installs/microsoft-office.md +760 -0
- package/src/installs/microsoft-teams.js +782 -25
- package/src/installs/microsoft-teams.md +886 -0
- package/src/installs/node.js +886 -26
- package/src/installs/node.md +1153 -0
- package/src/installs/nordpass.js +698 -26
- package/src/installs/nordpass.md +921 -0
- package/src/installs/nvm.js +977 -26
- package/src/installs/nvm.md +1057 -0
- package/src/installs/openssh.js +734 -64
- package/src/installs/openssh.md +1056 -0
- package/src/installs/pandoc.js +644 -26
- package/src/installs/pandoc.md +1036 -0
- package/src/installs/pinentry.js +492 -26
- package/src/installs/pinentry.md +1142 -0
- package/src/installs/pngyu.js +851 -26
- package/src/installs/pngyu.md +896 -0
- package/src/installs/postman.js +781 -26
- package/src/installs/postman.md +940 -0
- package/src/installs/procps.js +425 -0
- package/src/installs/procps.md +851 -0
- package/src/installs/safari-tech-preview.js +355 -25
- package/src/installs/safari-tech-preview.md +533 -0
- package/src/installs/sfnt2woff.js +640 -26
- package/src/installs/sfnt2woff.md +795 -0
- package/src/installs/shellcheck.js +463 -26
- package/src/installs/shellcheck.md +1005 -0
- package/src/installs/slack.js +722 -25
- package/src/installs/slack.md +865 -0
- package/src/installs/snagit.js +566 -25
- package/src/installs/snagit.md +844 -0
- package/src/installs/software-properties-common.js +372 -0
- package/src/installs/software-properties-common.md +805 -0
- package/src/installs/spotify.js +858 -25
- package/src/installs/spotify.md +901 -0
- package/src/installs/studio-3t.js +803 -26
- package/src/installs/studio-3t.md +918 -0
- package/src/installs/sublime-text.js +780 -25
- package/src/installs/sublime-text.md +914 -0
- package/src/installs/superwhisper.js +687 -25
- package/src/installs/superwhisper.md +630 -0
- package/src/installs/tailscale.js +727 -26
- package/src/installs/tailscale.md +1100 -0
- package/src/installs/tar.js +389 -0
- package/src/installs/tar.md +946 -0
- package/src/installs/termius.js +780 -26
- package/src/installs/termius.md +844 -0
- package/src/installs/terraform.js +761 -26
- package/src/installs/terraform.md +899 -0
- package/src/installs/tidal.js +752 -25
- package/src/installs/tidal.md +864 -0
- package/src/installs/tmux.js +328 -26
- package/src/installs/tmux.md +1030 -0
- package/src/installs/tree.js +393 -26
- package/src/installs/tree.md +833 -0
- package/src/installs/unzip.js +460 -0
- package/src/installs/unzip.md +879 -0
- package/src/installs/vim.js +403 -26
- package/src/installs/vim.md +1040 -0
- package/src/installs/vlc.js +803 -26
- package/src/installs/vlc.md +927 -0
- package/src/installs/vscode.js +825 -26
- package/src/installs/vscode.md +1002 -0
- package/src/installs/wget.js +415 -0
- package/src/installs/wget.md +791 -0
- package/src/installs/whatsapp.js +710 -25
- package/src/installs/whatsapp.md +854 -0
- package/src/installs/winpty.js +352 -0
- package/src/installs/winpty.md +620 -0
- package/src/installs/woff2.js +535 -26
- package/src/installs/woff2.md +977 -0
- package/src/installs/wsl.js +572 -0
- package/src/installs/wsl.md +699 -0
- package/src/installs/xcode-clt.js +520 -0
- package/src/installs/xcode-clt.md +351 -0
- package/src/installs/xcode.js +542 -26
- package/src/installs/xcode.md +573 -0
- package/src/installs/yarn.js +806 -26
- package/src/installs/yarn.md +1074 -0
- package/src/installs/yq.js +636 -26
- package/src/installs/yq.md +944 -0
- package/src/installs/yt-dlp.js +683 -26
- package/src/installs/yt-dlp.md +946 -0
- package/src/installs/yum-utils.js +297 -0
- package/src/installs/yum-utils.md +648 -0
- package/src/installs/zoom.js +740 -25
- package/src/installs/zoom.md +884 -0
- package/src/scripts/README.md +567 -45
- package/src/scripts/STATUS.md +208 -0
- package/src/scripts/afk.js +395 -7
- package/src/scripts/backup-all.js +731 -9
- package/src/scripts/backup-source.js +711 -8
- package/src/scripts/brewd.js +373 -7
- package/src/scripts/brewi.js +505 -9
- package/src/scripts/brewr.js +512 -9
- package/src/scripts/brews.js +462 -9
- package/src/scripts/brewu.js +488 -7
- package/src/scripts/c.js +185 -7
- package/src/scripts/ccurl.js +325 -8
- package/src/scripts/certbot-crontab-init.js +488 -8
- package/src/scripts/certbot-init.js +641 -9
- package/src/scripts/ch.js +339 -7
- package/src/scripts/claude-danger.js +253 -8
- package/src/scripts/clean-dev.js +419 -8
- package/src/scripts/clear-dns-cache.js +525 -7
- package/src/scripts/clone.js +417 -7
- package/src/scripts/code-all.js +420 -7
- package/src/scripts/count-files.js +195 -8
- package/src/scripts/count-folders.js +195 -8
- package/src/scripts/count.js +248 -8
- package/src/scripts/d.js +203 -7
- package/src/scripts/datauri.js +373 -8
- package/src/scripts/delete-files.js +363 -7
- package/src/scripts/docker-clean.js +410 -8
- package/src/scripts/dp.js +426 -7
- package/src/scripts/e.js +375 -9
- package/src/scripts/empty-trash.js +497 -7
- package/src/scripts/evm.js +428 -9
- package/src/scripts/fetch-github-repos.js +441 -10
- package/src/scripts/get-channel.js +329 -8
- package/src/scripts/get-course.js +384 -11
- package/src/scripts/get-dependencies.js +290 -9
- package/src/scripts/get-folder.js +783 -10
- package/src/scripts/get-tunes.js +411 -10
- package/src/scripts/get-video.js +352 -9
- package/src/scripts/git-backup.js +561 -9
- package/src/scripts/git-clone.js +477 -9
- package/src/scripts/git-pup.js +303 -7
- package/src/scripts/git-push.js +380 -8
- package/src/scripts/h.js +607 -9
- package/src/scripts/hide-desktop-icons.js +483 -7
- package/src/scripts/hide-hidden-files.js +522 -7
- package/src/scripts/install-dependencies-from.js +440 -9
- package/src/scripts/ips.js +647 -10
- package/src/scripts/iso.js +354 -8
- package/src/scripts/killni.js +561 -7
- package/src/scripts/ll.js +451 -8
- package/src/scripts/local-ip.js +310 -8
- package/src/scripts/m.js +508 -8
- package/src/scripts/map.js +293 -8
- package/src/scripts/mkd.js +287 -7
- package/src/scripts/ncu-update-all.js +441 -8
- package/src/scripts/nginx-init.js +702 -12
- package/src/scripts/npmi.js +366 -7
- package/src/scripts/o.js +495 -8
- package/src/scripts/org-by-date.js +321 -7
- package/src/scripts/p.js +208 -7
- package/src/scripts/packages.js +313 -8
- package/src/scripts/path.js +209 -7
- package/src/scripts/ports.js +582 -8
- package/src/scripts/q.js +290 -8
- package/src/scripts/refresh-files.js +378 -10
- package/src/scripts/remove-smaller-files.js +500 -8
- package/src/scripts/rename-files-with-date.js +517 -9
- package/src/scripts/resize-image.js +523 -9
- package/src/scripts/rm-safe.js +653 -8
- package/src/scripts/s.js +525 -9
- package/src/scripts/set-git-public.js +349 -7
- package/src/scripts/show-desktop-icons.js +459 -7
- package/src/scripts/show-hidden-files.js +456 -7
- package/src/scripts/tpa.js +265 -8
- package/src/scripts/tpo.js +264 -7
- package/src/scripts/u.js +489 -7
- package/src/scripts/vpush.js +422 -8
- package/src/scripts/y.js +267 -7
- package/src/utils/common/os.js +94 -2
- package/src/utils/ubuntu/apt.js +13 -7
|
@@ -0,0 +1,899 @@
|
|
|
1
|
+
# Installing Terraform
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Terraform is an open-source infrastructure as code (IaC) tool created by HashiCorp. It enables you to define, provision, and manage cloud infrastructure across multiple providers (AWS, Azure, GCP, and many others) using declarative configuration files written in HashiCorp Configuration Language (HCL). Terraform tracks infrastructure state, enabling safe and predictable changes through its plan-and-apply workflow.
|
|
6
|
+
|
|
7
|
+
Key capabilities include:
|
|
8
|
+
|
|
9
|
+
- **Multi-cloud provisioning**: Manage resources across AWS, Azure, GCP, Kubernetes, and 3,000+ providers
|
|
10
|
+
- **State management**: Track infrastructure state to detect drift and enable safe updates
|
|
11
|
+
- **Dependency resolution**: Automatically determine the order of resource creation and destruction
|
|
12
|
+
- **Module ecosystem**: Reuse infrastructure patterns through the Terraform Registry
|
|
13
|
+
|
|
14
|
+
## Dependencies
|
|
15
|
+
|
|
16
|
+
### macOS (Homebrew)
|
|
17
|
+
- **Required:**
|
|
18
|
+
- Homebrew - Install via `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
|
|
19
|
+
- **Optional:** None
|
|
20
|
+
- **Auto-installed:** None (Homebrew handles its own dependencies)
|
|
21
|
+
|
|
22
|
+
### Ubuntu (APT/Snap)
|
|
23
|
+
- **Required:**
|
|
24
|
+
- `gnupg` - Install via `sudo apt-get install -y gnupg`
|
|
25
|
+
- `software-properties-common` - Install via `sudo apt-get install -y software-properties-common`
|
|
26
|
+
- `wget` - Install via `sudo apt-get install -y wget`
|
|
27
|
+
- **Optional:**
|
|
28
|
+
- `lsb-release` - Install via `sudo apt-get install -y lsb-release` (fallback for distribution codename detection)
|
|
29
|
+
- **Auto-installed:** Dependencies of the `terraform` APT package
|
|
30
|
+
|
|
31
|
+
### Raspberry Pi OS (APT/Snap)
|
|
32
|
+
- **Required:**
|
|
33
|
+
- `wget` - Install via `sudo apt-get install -y wget` (usually pre-installed)
|
|
34
|
+
- `unzip` - Install via `sudo apt-get install -y unzip`
|
|
35
|
+
- **Optional:**
|
|
36
|
+
- `ca-certificates` - Install via `sudo apt-get install -y ca-certificates` (for SSL certificate validation, usually pre-installed)
|
|
37
|
+
- **Auto-installed:** None (manual binary installation)
|
|
38
|
+
|
|
39
|
+
### Amazon Linux (DNF/YUM)
|
|
40
|
+
- **Required:**
|
|
41
|
+
- `yum-utils` - Install via `sudo yum install -y yum-utils`
|
|
42
|
+
- **Optional:** None
|
|
43
|
+
- **Auto-installed:** Dependencies of the `terraform` YUM package
|
|
44
|
+
|
|
45
|
+
### Windows (Chocolatey/winget)
|
|
46
|
+
- **Required:**
|
|
47
|
+
- Chocolatey - Install via PowerShell (Administrator): `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))`
|
|
48
|
+
- **Optional:** None
|
|
49
|
+
- **Auto-installed:** None (Chocolatey handles its own dependencies)
|
|
50
|
+
|
|
51
|
+
### Git Bash (Manual/Portable)
|
|
52
|
+
- **Required (for Chocolatey method):**
|
|
53
|
+
- Chocolatey on Windows - See Windows section above for installation
|
|
54
|
+
- **Required (for manual installation):**
|
|
55
|
+
- `curl` or `wget` - Usually available in Git Bash
|
|
56
|
+
- `unzip` - Usually available in Git Bash, or install via `choco install unzip -y` from PowerShell
|
|
57
|
+
- **Optional:** None
|
|
58
|
+
- **Auto-installed:** None
|
|
59
|
+
|
|
60
|
+
## Prerequisites
|
|
61
|
+
|
|
62
|
+
Before installing Terraform on any platform, ensure:
|
|
63
|
+
|
|
64
|
+
1. **Internet connectivity** - Required to download Terraform packages and providers
|
|
65
|
+
2. **Administrative privileges** - Required for system-wide installation on most platforms
|
|
66
|
+
3. **64-bit operating system** - Terraform binaries are available for 64-bit systems (and 32-bit on some platforms)
|
|
67
|
+
|
|
68
|
+
**Important**: If you have older Terraform installations, they will be upgraded or replaced during package manager installation. Manual installations should be removed to avoid PATH conflicts.
|
|
69
|
+
|
|
70
|
+
## Platform-Specific Installation
|
|
71
|
+
|
|
72
|
+
### macOS (Homebrew)
|
|
73
|
+
|
|
74
|
+
#### Prerequisites
|
|
75
|
+
|
|
76
|
+
- macOS 11 (Big Sur) or later
|
|
77
|
+
- Homebrew package manager installed
|
|
78
|
+
- Terminal access
|
|
79
|
+
|
|
80
|
+
If Homebrew is not installed, install it first:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Installation Steps
|
|
87
|
+
|
|
88
|
+
**Step 1: Add the HashiCorp tap**
|
|
89
|
+
|
|
90
|
+
First, install the HashiCorp tap, which is HashiCorp's official Homebrew repository:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
brew tap hashicorp/tap
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Step 2: Install Terraform**
|
|
97
|
+
|
|
98
|
+
Run the following command to install Terraform:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
brew install --quiet hashicorp/tap/terraform
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The `--quiet` flag suppresses non-essential output, making the command suitable for automation scripts. Using the HashiCorp tap ensures you receive official releases directly from HashiCorp.
|
|
105
|
+
|
|
106
|
+
#### Verification
|
|
107
|
+
|
|
108
|
+
Confirm the installation succeeded:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
terraform --version
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Expected output (version numbers may vary):
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Terraform v1.14.3
|
|
118
|
+
on darwin_arm64
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Test that Terraform can initialize:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
terraform -help
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This should display the list of available Terraform commands.
|
|
128
|
+
|
|
129
|
+
#### Troubleshooting
|
|
130
|
+
|
|
131
|
+
**Problem**: `terraform: command not found` after installation
|
|
132
|
+
|
|
133
|
+
**Solution**: Homebrew may not be in your PATH. Add it by running:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
For permanent fix, add the above line to your `~/.zshrc` or `~/.bash_profile`.
|
|
140
|
+
|
|
141
|
+
**Problem**: Tap already exists error
|
|
142
|
+
|
|
143
|
+
**Solution**: Update the existing tap:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
brew update
|
|
147
|
+
brew upgrade hashicorp/tap/terraform
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Problem**: Permission denied errors
|
|
151
|
+
|
|
152
|
+
**Solution**: Fix Homebrew permissions:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
sudo chown -R $(whoami) /opt/homebrew
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### Ubuntu/Debian (APT)
|
|
161
|
+
|
|
162
|
+
#### Prerequisites
|
|
163
|
+
|
|
164
|
+
- Ubuntu 20.04 or later, or Debian 10 (Buster) or later (64-bit)
|
|
165
|
+
- sudo privileges
|
|
166
|
+
- `wget`, `gnupg`, and `software-properties-common` packages
|
|
167
|
+
|
|
168
|
+
**Important**: Do not use `snap install terraform`. The Snap package is maintained by the community, not HashiCorp. Use the official HashiCorp APT repository for production environments.
|
|
169
|
+
|
|
170
|
+
#### Installation Steps
|
|
171
|
+
|
|
172
|
+
**Step 1: Install prerequisite packages**
|
|
173
|
+
|
|
174
|
+
Ensure your system has the required packages for GPG key management:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
178
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg software-properties-common wget
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Step 2: Add HashiCorp's GPG key**
|
|
182
|
+
|
|
183
|
+
Download and install HashiCorp's GPG key for package verification:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Step 3: Add the HashiCorp repository**
|
|
190
|
+
|
|
191
|
+
Add the official HashiCorp repository to your APT sources:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Step 4: Install Terraform**
|
|
198
|
+
|
|
199
|
+
Update the package list and install Terraform:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
203
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y terraform
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### Verification
|
|
207
|
+
|
|
208
|
+
Confirm the installation succeeded:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
terraform --version
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Expected output (version numbers may vary):
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
Terraform v1.14.3
|
|
218
|
+
on linux_amd64
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Troubleshooting
|
|
222
|
+
|
|
223
|
+
**Problem**: `E: Unable to locate package terraform`
|
|
224
|
+
|
|
225
|
+
**Solution**: The repository was not added correctly. Verify the hashicorp.list file exists and contains valid content:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
cat /etc/apt/sources.list.d/hashicorp.list
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
If empty or missing, repeat Steps 2 and 3.
|
|
232
|
+
|
|
233
|
+
**Problem**: GPG key import fails
|
|
234
|
+
|
|
235
|
+
**Solution**: Ensure wget is installed and you have network connectivity:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y wget ca-certificates
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Problem**: `lsb_release: command not found`
|
|
242
|
+
|
|
243
|
+
**Solution**: Install the lsb-release package:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lsb-release
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Alternatively, the command uses a fallback to `/etc/os-release` which should work on most systems.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
### Raspberry Pi OS (APT)
|
|
254
|
+
|
|
255
|
+
#### Prerequisites
|
|
256
|
+
|
|
257
|
+
- Raspberry Pi OS (64-bit strongly recommended) - Bookworm or Bullseye
|
|
258
|
+
- Raspberry Pi 3B+ or later (64-bit capable hardware)
|
|
259
|
+
- sudo privileges
|
|
260
|
+
|
|
261
|
+
**Important Architecture Note**: The HashiCorp APT repository provides packages only for AMD64 (x86_64) architecture. For ARM-based Raspberry Pi systems, you must use manual binary installation with the Linux ARM64 binary.
|
|
262
|
+
|
|
263
|
+
First, verify your architecture:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
uname -m
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
- `aarch64` = 64-bit ARM (use manual installation below)
|
|
270
|
+
- `armv7l` = 32-bit ARM (use manual installation below, 32-bit binary)
|
|
271
|
+
- `x86_64` = 64-bit Intel/AMD (can use APT repository)
|
|
272
|
+
|
|
273
|
+
#### Installation Steps
|
|
274
|
+
|
|
275
|
+
**For ARM64 Raspberry Pi OS (aarch64) - Manual Binary Installation:**
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Download the latest Terraform ARM64 binary
|
|
279
|
+
TERRAFORM_VERSION="1.14.3"
|
|
280
|
+
wget -q "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_arm64.zip" -O /tmp/terraform.zip
|
|
281
|
+
|
|
282
|
+
# Install unzip if not present
|
|
283
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
284
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y unzip
|
|
285
|
+
|
|
286
|
+
# Extract and install
|
|
287
|
+
unzip -o -q /tmp/terraform.zip -d /tmp
|
|
288
|
+
sudo mv /tmp/terraform /usr/local/bin/
|
|
289
|
+
sudo chmod +x /usr/local/bin/terraform
|
|
290
|
+
|
|
291
|
+
# Clean up
|
|
292
|
+
rm -f /tmp/terraform.zip
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**For 32-bit Raspberry Pi OS (armv7l):**
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
# Download the 32-bit ARM binary
|
|
299
|
+
TERRAFORM_VERSION="1.14.3"
|
|
300
|
+
wget -q "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_arm.zip" -O /tmp/terraform.zip
|
|
301
|
+
|
|
302
|
+
# Install unzip if not present
|
|
303
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
304
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y unzip
|
|
305
|
+
|
|
306
|
+
# Extract and install
|
|
307
|
+
unzip -o -q /tmp/terraform.zip -d /tmp
|
|
308
|
+
sudo mv /tmp/terraform /usr/local/bin/
|
|
309
|
+
sudo chmod +x /usr/local/bin/terraform
|
|
310
|
+
|
|
311
|
+
# Clean up
|
|
312
|
+
rm -f /tmp/terraform.zip
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### Verification
|
|
316
|
+
|
|
317
|
+
Confirm the installation succeeded:
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
terraform --version
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Expected output for ARM64 (version numbers may vary):
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
Terraform v1.14.3
|
|
327
|
+
on linux_arm64
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### Troubleshooting
|
|
331
|
+
|
|
332
|
+
**Problem**: `terraform: command not found` after installation
|
|
333
|
+
|
|
334
|
+
**Solution**: Ensure `/usr/local/bin` is in your PATH:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
echo $PATH | grep -q "/usr/local/bin" || export PATH=$PATH:/usr/local/bin
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
For permanent fix, add to `~/.bashrc`:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc
|
|
344
|
+
source ~/.bashrc
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Problem**: `unzip: command not found`
|
|
348
|
+
|
|
349
|
+
**Solution**: Install unzip:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y unzip
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**Problem**: Download fails with certificate error
|
|
356
|
+
|
|
357
|
+
**Solution**: Install CA certificates:
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Problem**: Slow download speeds
|
|
364
|
+
|
|
365
|
+
**Solution**: Raspberry Pi SD cards and network can be slow. Use a wired ethernet connection and a high-quality SD card (Class 10 or faster), or boot from USB/SSD.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
### Amazon Linux/RHEL (YUM/DNF)
|
|
370
|
+
|
|
371
|
+
#### Prerequisites
|
|
372
|
+
|
|
373
|
+
- Amazon Linux 2023 (AL2023), Amazon Linux 2 (AL2), or RHEL 7/8/9
|
|
374
|
+
- sudo privileges
|
|
375
|
+
- `yum-utils` package (for repository management)
|
|
376
|
+
|
|
377
|
+
**Note**: Amazon Linux 2023 uses DNF as the default package manager. Amazon Linux 2 and older RHEL versions use YUM. The commands below use YUM which works on both.
|
|
378
|
+
|
|
379
|
+
#### Installation Steps
|
|
380
|
+
|
|
381
|
+
**Step 1: Install yum-utils**
|
|
382
|
+
|
|
383
|
+
Install the yum-utils package for repository management:
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
sudo yum install -y yum-utils
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**Step 2: Add the HashiCorp repository**
|
|
390
|
+
|
|
391
|
+
**For Amazon Linux:**
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**For RHEL/CentOS:**
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Step 3: Install Terraform**
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
sudo yum install -y terraform
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### Verification
|
|
410
|
+
|
|
411
|
+
Confirm the installation succeeded:
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
terraform --version
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Expected output (version numbers may vary):
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
Terraform v1.14.3
|
|
421
|
+
on linux_amd64
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Verify the repository is configured:
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
yum repolist | grep hashicorp
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
#### Troubleshooting
|
|
431
|
+
|
|
432
|
+
**Problem**: `No package terraform available`
|
|
433
|
+
|
|
434
|
+
**Solution**: The repository was not added correctly. Verify it exists:
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
ls /etc/yum.repos.d/ | grep hashicorp
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
If missing, repeat Step 2.
|
|
441
|
+
|
|
442
|
+
**Problem**: Repository GPG key verification fails
|
|
443
|
+
|
|
444
|
+
**Solution**: Import the HashiCorp GPG key manually:
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
sudo rpm --import https://rpm.releases.hashicorp.com/gpg
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Problem**: DNF vs YUM confusion on Amazon Linux 2023
|
|
451
|
+
|
|
452
|
+
**Solution**: Both `yum` and `dnf` work on AL2023 as `yum` is aliased to `dnf`. The commands above work on both AL2 and AL2023.
|
|
453
|
+
|
|
454
|
+
**Problem**: Package conflicts with previous installation
|
|
455
|
+
|
|
456
|
+
**Solution**: Remove any manually installed Terraform first:
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
sudo rm -f /usr/local/bin/terraform
|
|
460
|
+
hash -r
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
### Windows (Chocolatey)
|
|
466
|
+
|
|
467
|
+
#### Prerequisites
|
|
468
|
+
|
|
469
|
+
- Windows 10 or Windows 11 (64-bit)
|
|
470
|
+
- Administrator PowerShell or Command Prompt
|
|
471
|
+
- Chocolatey package manager installed
|
|
472
|
+
|
|
473
|
+
**Note**: HashiCorp does not maintain the Chocolatey package directly. For production environments requiring the absolute latest version on release day, consider manual installation. However, Chocolatey is regularly updated and provides a convenient installation method.
|
|
474
|
+
|
|
475
|
+
If Chocolatey is not installed, install it first by running this command in an Administrator PowerShell:
|
|
476
|
+
|
|
477
|
+
```powershell
|
|
478
|
+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### Installation Steps
|
|
482
|
+
|
|
483
|
+
Run the following command in an Administrator PowerShell or Command Prompt:
|
|
484
|
+
|
|
485
|
+
```powershell
|
|
486
|
+
choco install terraform -y
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
The `-y` flag automatically confirms all prompts, enabling fully non-interactive installation.
|
|
490
|
+
|
|
491
|
+
#### Verification
|
|
492
|
+
|
|
493
|
+
Open a new Command Prompt or PowerShell window (required for PATH to update), then run:
|
|
494
|
+
|
|
495
|
+
```powershell
|
|
496
|
+
terraform --version
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
Expected output (version numbers may vary):
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
Terraform v1.14.3
|
|
503
|
+
on windows_amd64
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
#### Troubleshooting
|
|
507
|
+
|
|
508
|
+
**Problem**: `terraform: The term 'terraform' is not recognized`
|
|
509
|
+
|
|
510
|
+
**Solution**: Open a new terminal window. The PATH is updated during installation but existing windows do not reflect this. Alternatively, refresh the environment:
|
|
511
|
+
|
|
512
|
+
```powershell
|
|
513
|
+
refreshenv
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**Problem**: Installation fails with access denied
|
|
517
|
+
|
|
518
|
+
**Solution**: Ensure you are running PowerShell or Command Prompt as Administrator. Right-click and select "Run as administrator".
|
|
519
|
+
|
|
520
|
+
**Problem**: Chocolatey installs an older version
|
|
521
|
+
|
|
522
|
+
**Solution**: Check for updates:
|
|
523
|
+
|
|
524
|
+
```powershell
|
|
525
|
+
choco upgrade terraform -y
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**Problem**: Need to install a specific version
|
|
529
|
+
|
|
530
|
+
**Solution**: Specify the version number:
|
|
531
|
+
|
|
532
|
+
```powershell
|
|
533
|
+
choco install terraform --version=1.14.3 -y
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
### WSL (Ubuntu)
|
|
539
|
+
|
|
540
|
+
#### Prerequisites
|
|
541
|
+
|
|
542
|
+
- Windows Subsystem for Linux with Ubuntu installed
|
|
543
|
+
- WSL 2 recommended for best performance
|
|
544
|
+
- sudo privileges within WSL
|
|
545
|
+
|
|
546
|
+
WSL Ubuntu installations follow the same process as native Ubuntu, using the HashiCorp APT repository. Because WSL provides a full Linux environment, you install Terraform inside WSL, not on Windows.
|
|
547
|
+
|
|
548
|
+
#### Installation Steps
|
|
549
|
+
|
|
550
|
+
Run these commands in your WSL Ubuntu terminal:
|
|
551
|
+
|
|
552
|
+
**Step 1: Install prerequisite packages**
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
556
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg software-properties-common wget
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
**Step 2: Add HashiCorp's GPG key**
|
|
560
|
+
|
|
561
|
+
```bash
|
|
562
|
+
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**Step 3: Add the HashiCorp repository**
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
**Step 4: Install Terraform**
|
|
572
|
+
|
|
573
|
+
```bash
|
|
574
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
575
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y terraform
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
#### Verification
|
|
579
|
+
|
|
580
|
+
Confirm the installation succeeded:
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
terraform --version
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Expected output (version numbers may vary):
|
|
587
|
+
|
|
588
|
+
```
|
|
589
|
+
Terraform v1.14.3
|
|
590
|
+
on linux_amd64
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
#### Troubleshooting
|
|
594
|
+
|
|
595
|
+
**Problem**: GPG key import fails with network error
|
|
596
|
+
|
|
597
|
+
**Solution**: WSL may have DNS issues. Try using Google's DNS:
|
|
598
|
+
|
|
599
|
+
```bash
|
|
600
|
+
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
**Problem**: `lsb_release: command not found`
|
|
604
|
+
|
|
605
|
+
**Solution**: Install the lsb-release package:
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lsb-release
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
**Problem**: Terraform works in WSL but not in Windows PowerShell
|
|
612
|
+
|
|
613
|
+
**Solution**: WSL and Windows have separate PATH environments. Terraform installed in WSL is only available within WSL. If you need Terraform in Windows, install it separately using Chocolatey (see Windows section).
|
|
614
|
+
|
|
615
|
+
**Problem**: File permission issues when working with Windows files
|
|
616
|
+
|
|
617
|
+
**Solution**: When accessing files in `/mnt/c/` (Windows filesystem), you may encounter permission issues. Store Terraform configurations in your WSL home directory (`~/`) for best compatibility, or configure WSL mount options in `/etc/wsl.conf`.
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
### Git Bash (Windows Installation)
|
|
622
|
+
|
|
623
|
+
#### Prerequisites
|
|
624
|
+
|
|
625
|
+
- Windows 10 or Windows 11 (64-bit)
|
|
626
|
+
- Git Bash installed (comes with Git for Windows)
|
|
627
|
+
- Terraform installed on Windows (see Windows section) OR manual installation
|
|
628
|
+
|
|
629
|
+
**Note**: Git Bash on Windows does not require a separate Terraform installation. Git Bash inherits the Windows PATH, so once Terraform is installed on Windows via Chocolatey, winget, or manual installation, the `terraform` command is automatically available in Git Bash.
|
|
630
|
+
|
|
631
|
+
#### Installation Steps
|
|
632
|
+
|
|
633
|
+
**Recommended Method: Use Chocolatey (see Windows section)**
|
|
634
|
+
|
|
635
|
+
Install Terraform on Windows using Chocolatey from an Administrator PowerShell:
|
|
636
|
+
|
|
637
|
+
```powershell
|
|
638
|
+
choco install terraform -y
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
Then open Git Bash - the `terraform` command will be available.
|
|
642
|
+
|
|
643
|
+
**Alternative: Manual Installation for Git Bash**
|
|
644
|
+
|
|
645
|
+
If you prefer not to use a package manager, download and configure Terraform manually:
|
|
646
|
+
|
|
647
|
+
**Step 1: Download Terraform**
|
|
648
|
+
|
|
649
|
+
Open Git Bash and download the Windows AMD64 binary:
|
|
650
|
+
|
|
651
|
+
```bash
|
|
652
|
+
TERRAFORM_VERSION="1.14.3"
|
|
653
|
+
curl -Lo /tmp/terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_windows_amd64.zip"
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
**Step 2: Extract and install**
|
|
657
|
+
|
|
658
|
+
```bash
|
|
659
|
+
# Create a directory for Terraform
|
|
660
|
+
mkdir -p ~/bin
|
|
661
|
+
|
|
662
|
+
# Extract the binary
|
|
663
|
+
unzip -o -q /tmp/terraform.zip -d ~/bin
|
|
664
|
+
|
|
665
|
+
# Clean up
|
|
666
|
+
rm -f /tmp/terraform.zip
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
**Step 3: Add to PATH**
|
|
670
|
+
|
|
671
|
+
Add the bin directory to your PATH in `~/.bashrc`:
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
|
|
675
|
+
source ~/.bashrc
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
#### Verification
|
|
679
|
+
|
|
680
|
+
In Git Bash, confirm Terraform is accessible:
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
terraform --version
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
Expected output (version numbers may vary):
|
|
687
|
+
|
|
688
|
+
```
|
|
689
|
+
Terraform v1.14.3
|
|
690
|
+
on windows_amd64
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
#### Troubleshooting
|
|
694
|
+
|
|
695
|
+
**Problem**: `terraform: command not found` in Git Bash after Chocolatey installation
|
|
696
|
+
|
|
697
|
+
**Solution**: Close and reopen Git Bash to inherit the updated Windows PATH. If it still does not work, verify Terraform is in the Windows PATH:
|
|
698
|
+
|
|
699
|
+
```bash
|
|
700
|
+
echo $PATH | tr ':' '\n' | grep -i terraform
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
If not found, add the Chocolatey bin directory:
|
|
704
|
+
|
|
705
|
+
```bash
|
|
706
|
+
echo 'export PATH=$PATH:/c/ProgramData/chocolatey/bin' >> ~/.bashrc
|
|
707
|
+
source ~/.bashrc
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**Problem**: PATH not persisting across Git Bash sessions
|
|
711
|
+
|
|
712
|
+
**Solution**: Ensure changes are in `~/.bashrc`, not `~/.bash_profile`. Git Bash sources `~/.bashrc` by default.
|
|
713
|
+
|
|
714
|
+
**Problem**: `unzip: command not found`
|
|
715
|
+
|
|
716
|
+
**Solution**: Git Bash includes unzip. If missing, use Git for Windows' built-in extraction or install unzip via Chocolatey:
|
|
717
|
+
|
|
718
|
+
```powershell
|
|
719
|
+
choco install unzip -y
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
**Problem**: curl SSL certificate errors
|
|
723
|
+
|
|
724
|
+
**Solution**: Update Git for Windows to the latest version, or use wget:
|
|
725
|
+
|
|
726
|
+
```bash
|
|
727
|
+
wget -q "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_windows_amd64.zip" -O /tmp/terraform.zip
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
---
|
|
731
|
+
|
|
732
|
+
## Post-Installation Configuration
|
|
733
|
+
|
|
734
|
+
After installing Terraform on any platform, consider these optional but recommended configurations.
|
|
735
|
+
|
|
736
|
+
### Enable Tab Completion
|
|
737
|
+
|
|
738
|
+
Terraform supports tab completion for Bash and Zsh. Install the completion script:
|
|
739
|
+
|
|
740
|
+
**For Bash:**
|
|
741
|
+
|
|
742
|
+
```bash
|
|
743
|
+
terraform -install-autocomplete
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
This adds the completion configuration to your `~/.bashrc`. Restart your shell or run:
|
|
747
|
+
|
|
748
|
+
```bash
|
|
749
|
+
source ~/.bashrc
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
**For Zsh:**
|
|
753
|
+
|
|
754
|
+
```bash
|
|
755
|
+
terraform -install-autocomplete
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
This adds the completion configuration to your `~/.zshrc`. Restart your shell or run:
|
|
759
|
+
|
|
760
|
+
```bash
|
|
761
|
+
source ~/.zshrc
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### Verify Provider Plugin Cache (Optional)
|
|
765
|
+
|
|
766
|
+
For faster provider downloads across multiple projects, configure a shared plugin cache:
|
|
767
|
+
|
|
768
|
+
```bash
|
|
769
|
+
mkdir -p ~/.terraform.d/plugin-cache
|
|
770
|
+
|
|
771
|
+
cat >> ~/.terraformrc << 'EOF'
|
|
772
|
+
plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"
|
|
773
|
+
EOF
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### Configure Credentials for Cloud Providers
|
|
777
|
+
|
|
778
|
+
Terraform needs credentials to interact with cloud providers. Configure them according to your target platform:
|
|
779
|
+
|
|
780
|
+
**AWS:**
|
|
781
|
+
|
|
782
|
+
```bash
|
|
783
|
+
aws configure
|
|
784
|
+
# Or set environment variables:
|
|
785
|
+
export AWS_ACCESS_KEY_ID="your-access-key"
|
|
786
|
+
export AWS_SECRET_ACCESS_KEY="your-secret-key"
|
|
787
|
+
export AWS_DEFAULT_REGION="us-east-1"
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
**Azure:**
|
|
791
|
+
|
|
792
|
+
```bash
|
|
793
|
+
az login
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
**Google Cloud:**
|
|
797
|
+
|
|
798
|
+
```bash
|
|
799
|
+
gcloud auth application-default login
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
---
|
|
803
|
+
|
|
804
|
+
## Common Issues
|
|
805
|
+
|
|
806
|
+
### Issue: "Terraform version X required, but version Y installed"
|
|
807
|
+
|
|
808
|
+
**Symptoms**: Error message indicating version mismatch when running `terraform init`.
|
|
809
|
+
|
|
810
|
+
**Solution**: Some projects require specific Terraform versions. Check the project's `required_version` constraint in `terraform` block. Install the required version or use a version manager like `tfenv`.
|
|
811
|
+
|
|
812
|
+
### Issue: Provider Plugin Download Failures
|
|
813
|
+
|
|
814
|
+
**Symptoms**: `terraform init` fails with network errors or timeouts.
|
|
815
|
+
|
|
816
|
+
**Solutions**:
|
|
817
|
+
|
|
818
|
+
- Check internet connectivity
|
|
819
|
+
- Configure proxy settings if behind a corporate firewall:
|
|
820
|
+
|
|
821
|
+
```bash
|
|
822
|
+
export HTTP_PROXY="http://proxy.example.com:8080"
|
|
823
|
+
export HTTPS_PROXY="http://proxy.example.com:8080"
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
- Use a provider mirror or network mirror (for air-gapped environments)
|
|
827
|
+
|
|
828
|
+
### Issue: State File Locking Errors
|
|
829
|
+
|
|
830
|
+
**Symptoms**: `Error acquiring the state lock` when running Terraform commands.
|
|
831
|
+
|
|
832
|
+
**Solutions**:
|
|
833
|
+
|
|
834
|
+
- Wait for other Terraform operations to complete
|
|
835
|
+
- If the lock is stale (previous operation crashed), force unlock:
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
terraform force-unlock LOCK_ID
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
**Warning**: Only use `force-unlock` when you are certain no other operation is running.
|
|
842
|
+
|
|
843
|
+
### Issue: "Permission denied" When Creating Resources
|
|
844
|
+
|
|
845
|
+
**Symptoms**: Cloud provider returns authorization or permission errors.
|
|
846
|
+
|
|
847
|
+
**Solution**: Verify your credentials have the necessary permissions:
|
|
848
|
+
|
|
849
|
+
```bash
|
|
850
|
+
# For AWS
|
|
851
|
+
aws sts get-caller-identity
|
|
852
|
+
|
|
853
|
+
# For Azure
|
|
854
|
+
az account show
|
|
855
|
+
|
|
856
|
+
# For GCP
|
|
857
|
+
gcloud auth list
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
### Issue: Large State Files Causing Slow Operations
|
|
861
|
+
|
|
862
|
+
**Symptoms**: `terraform plan` and `terraform apply` take a long time.
|
|
863
|
+
|
|
864
|
+
**Solutions**:
|
|
865
|
+
|
|
866
|
+
- Use remote state backends (S3, Azure Blob, GCS) instead of local state
|
|
867
|
+
- Split large configurations into smaller, focused modules
|
|
868
|
+
- Use `-target` flag sparingly to operate on specific resources
|
|
869
|
+
|
|
870
|
+
### Issue: "Backend configuration changed"
|
|
871
|
+
|
|
872
|
+
**Symptoms**: Error when switching between backend configurations.
|
|
873
|
+
|
|
874
|
+
**Solution**: Migrate state to the new backend:
|
|
875
|
+
|
|
876
|
+
```bash
|
|
877
|
+
terraform init -migrate-state
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
Or reconfigure without migrating (use with caution):
|
|
881
|
+
|
|
882
|
+
```bash
|
|
883
|
+
terraform init -reconfigure
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
---
|
|
887
|
+
|
|
888
|
+
## References
|
|
889
|
+
|
|
890
|
+
- [Terraform Official Installation Documentation](https://developer.hashicorp.com/terraform/install)
|
|
891
|
+
- [Terraform CLI Install Tutorial](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)
|
|
892
|
+
- [Terraform APT Packages (Ubuntu/Debian)](https://developer.hashicorp.com/terraform/cli/install/apt)
|
|
893
|
+
- [Terraform YUM Packages (RHEL/Amazon Linux)](https://developer.hashicorp.com/terraform/cli/install/yum)
|
|
894
|
+
- [Terraform Releases Page](https://releases.hashicorp.com/terraform/)
|
|
895
|
+
- [Terraform GitHub Repository](https://github.com/hashicorp/terraform)
|
|
896
|
+
- [HashiCorp Homebrew Tap](https://github.com/hashicorp/homebrew-tap)
|
|
897
|
+
- [Terraform Chocolatey Package](https://community.chocolatey.org/packages/terraform)
|
|
898
|
+
- [Microsoft Learn: Install Terraform on Windows with Bash](https://learn.microsoft.com/en-us/azure/developer/terraform/get-started-windows-bash)
|
|
899
|
+
- [Terraform Registry (Providers and Modules)](https://registry.terraform.io/)
|