Terraform Setup on Windows and Mac: Terraform, AWS CLI, Git and VS Code Without Access Keys
What you’ll learn
- Install Terraform, the AWS CLI, Git and VS Code, and check each one
- Sign in the AWS CLI with aws login – short-lived credentials, no access keys
- Point Terraform at that sign-in with AWS_PROFILE
- Prove the whole toolchain works with a read-only Terraform plan
What you need
- Lesson 001
- An IAM user with console access (we use our admin user, never the root user)
What you need
First, the four tools we use, and why. Terraform builds the infrastructure. The AWS CLI signs you in to AWS, and Terraform uses the same sign-in. Git keeps every file, and every change. And VS Code, to edit the files. Plus one rule from day one. No access keys.
No access keys
Why no access keys? An access key never expires. If it leaks, in a file, a screenshot, or a Git repo, anyone can use it until someone notices. Instead, we sign in with aws login, which gives the CLI credentials that expire on their own. Let's check that our user has no keys. In IAM, open IAM users.

Choose our admin user, and open the Security credentials tab.

At the top, multi-factor authentication. If yours isn't set up yet, assign an MFA device here first. It protects the console sign-in that aws login uses.

And under Access keys, there are none. That's how it stays for the whole course. Laptops use aws login, and pipelines get roles. No keys in code, in settings, or in videos.

Install the tools
First, Git, from git-scm.com. On Windows, run the installer and keep the defaults. It also installs Git Bash, the terminal we use in this whole course, so every command is the same on Windows, Mac and Linux. On a Mac, Git comes with the Xcode command line tools.

Open Git Bash, or Terminal on a Mac. git –version confirms Git is installed. Git keeps every version of your code.
git --version

Next, Terraform. HashiCorp's install page has a download for every system. On Windows, download the AMD64 zip, put terraform.exe in a folder like C:\terraform, and add that folder to your Path. On a Mac, use Homebrew.

Check it with terraform version, which shows the version that is installed. We use 1.17. If it says a newer version is out, that's fine for now. Lesson 16 is all about upgrades.
terraform version

The AWS CLI, version 2, comes from the AWS install guide. Windows has an M S I installer, and macOS has a package. Follow the steps for your system.

Check it with aws –version, which shows the installed version. Ours is version 2.
aws --version

And VS Code, with the HashiCorp Terraform extension. In VS Code, open Extensions, search for HashiCorp Terraform, and install it. It colours the code, completes names, and formats your files when you save.

code –version checks VS Code from the terminal.
code --version

Sign in without keys
Now we sign the CLI in. aws login, –profile course. Course is just the name we give this sign-in. Use any name you like. It opens your browser, where you sign in to the console as usual, and approve. We've already done that, so we won't run it again here.
aws login --profile course

Let's test the sign-in with a command that only reads. aws ec2 describe-availability-zones lists the zones in us-east-1. –region picks the Region. –query keeps only the zone names, and output text prints them on one line. –profile course uses the sign-in we just made. Six zones. The CLI is signed in.
aws ec2 describe-availability-zones --region us-east-1 --query "AvailabilityZones[].ZoneName" --output text --profile course

Terraform uses the same sign-in. The AWS profile variable tells it which one. export AWS profile equals course. Do this in every new terminal you open.
export AWS_PROFILE=course

Test it all together
Last, we test everything together, with a tiny Terraform file that only reads from AWS. It creates nothing. cd moves into the lesson folder.
cd terraform/002-toolchain-check
We need a file called main.tf, where we write the check. touch creates the empty file, and it appears in the Explorer.
touch main.tf
Now we type it. The terraform block now has required version. This code needs Terraform 1.17 or newer, and the AWS provider, version 6.
terraform {
required_version = ">= 1.17.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 6.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
data "aws_region" "current" {}
data "aws_availability_zones" "available" {
state = "available"
}
output "region" {
value = data.aws_region.current.region
}
output "zones" {
value = data.aws_availability_zones.available.names
}
The provider block sets the Region. Then two data blocks. A data block reads something that already exists. The current Region, and the Availability Zones that are available.
And two outputs, to print what Terraform read. The Region's name, and the list of zone names.

terraform init downloads the AWS provider. Keep an eye on the Explorer. init adds two items to the folder.
terraform init
There they are. The .terraform folder, with the provider inside, and the lock file, with its exact version.

Now terraform plan. To read the data, Terraform has to sign in to AWS with our profile.
terraform plan
And it worked. Changes to Outputs only, the Region and its six zones. Nothing in AWS would change. Terraform, the CLI and the sign-in all work together.

Clean up
This lesson created nothing in AWS, so there's nothing to delete there, and it cost nothing. init made a local .terraform folder, with the provider download. Watch it leave the Explorer. We delete it with rm (remove). -r includes everything inside the folder, and -f skips the are you sure question. Init brings it back whenever it's needed.
rm -rf .terraform

Summary
- No access keys – aws login gives the CLI and Terraform short-lived credentials that expire on their own
- Check every tool with its version command – terraform version, aws –version, git –version, code –version
- AWS_PROFILE tells Terraform which CLI sign-in to use; set it in every new terminal
- A data source only reads from AWS, so a plan with data sources and outputs changes nothing
- Cost of this lesson: free – nothing is created in AWS
What’s next
Your workstation is ready. Next lesson, your first real apply. Larkvale's first bucket, every line explained, and every command run the safe way.