This document provides macOS-specific guidance for the Terraform workshop.
Recommended: Using Homebrew
# Install Homebrew if needed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install workshop tools
brew install terraform
brew install --cask google-cloud-sdk
brew install git # Usually pre-installed, but gets latest versionAlternative: Follow official guides at Terraform Install and Google Cloud SDK Install
- Go to Google Cloud Console and log in with your Google account.
- Note the project ID you'll be using for the workshop.
In Terminal:
# Log in to Google Cloud
gcloud auth login
# Set the workshop project (if not prompted during login)
gcloud config set project cloud-labs-workshop-42clws
# Set up application default credentials for Terraform
gcloud auth application-default login
# Verify your setup
gcloud config listRun the setup verification script:
./verify-setup.shThis script will check that you have all required tools installed and properly configured.
macOS uses zsh as the default shell (since macOS 10.15). The workshop commands work with the default zsh configuration.
Terminal.app (built-in) works perfectly for the workshop. iTerm2 is a popular alternative with additional features.
Common Issues and Solutions:
-
"terraform: command not found": Ensure Terraform is in your PATH. Restart your terminal after installation.
-
"gcloud: command not found": Ensure Google Cloud SDK is in your PATH. You may need to restart your terminal or reinstall the SDK.
-
"gcloud auth list shows no accounts": Run
gcloud auth loginto authenticate. -
"Permission denied" when accessing project: Ensure you have the necessary IAM roles in the project. Contact workshop facilitators if using the provided project.
-
"Application Default Credentials not found": Run
gcloud auth application-default loginto set up credentials for Terraform. -
Terraform provider errors: Make sure you're in the
infra/directory and have runterraform init.
# Update Homebrew
brew update
# Fix common issues
brew doctorIf commands aren't found after installation:
# Check your PATH
echo $PATH
# For Apple Silicon Macs, ensure Homebrew is in PATH
export PATH="/opt/homebrew/bin:$PATH"# If gcloud not found after Homebrew installation
gcloud init
# For manual installation, source the SDK
source ~/google-cloud-sdk/path.zsh.incVisual Studio Code is recommended for the workshop:
# Install VS Code via Homebrew
brew install --cask visual-studio-code
# Install Terraform extension
code --install-extension HashiCorp.terraformTerraform-specific plugins are available for:
- (Neo)Vim: vim-terraform
- IntelliJ IDEA: Terraform and HCL plugin
- Built-in editors: TextEdit,
vim, or your preferred editor
# Navigation and files
cd directory # Change directory
ls -la # List files
vim filename.tf # Edit with vim
code filename.tf # Edit with VS Code
# System information
sw_vers # macOS version- Cmd+T - New terminal tab
- Cmd+K - Clear terminal screen
- Cmd+C/V - Copy/Paste
terraform --help
gcloud --help
man terraform # Manual pages
brew --help # Homebrew helpIf you encounter macOS-specific issues during the workshop, try the solutions above or ask workshop facilitators for help.