Terraform CLI Config File Windows OS
Step-01: Introduction¶
- Terraform CLI Config File
- Understand about
Terraform CLI Config File - Windows: terraform.rc
Step-02: Create terraform.rc in User Home Directory¶
- On Windows, the file must be named terraform.rc and placed in the relevant user's
%APPDATA%directory. - The physical location of this directory depends on your Windows version and system configuration; use
$env:APPDATAin PowerShell to find its location on your system. - On Windows, beware of Windows Explorer's default behavior of hiding filename extensions.
- Terraform will not recognize a file named
terraform.rc.txtas a CLI configuration file, even though Windows Explorer may display its name as justterraform.rc. - Use
dirfromPowerShellorCommand Promptto confirm the filename.
Step-03: Update terraform.rc with Plugin Cache Folder¶
Step-04: Execute Terraform Commands¶
# Change Directory
cd 66-Terraform-CLI-Config-File-WindowsOS/terraform-manifests
# Terraform Initialize
terraform init
# Verify the contents in Plugin Cache Directory
C:\Users\Administrator\Documents\plugin_cache
C:\Users\Administrator\Documents\plugin_cache\registry.terraform.io\hashicorp
Step-05: Verify if plugins loaded from Cache¶
# Change Directory
cd 66-Terraform-CLI-Config-File-WindowsOS/terraform-manifests
# Remove .terraform Folder which contains plugins
Delete folder .terraform
# Terraform Initialize
terraform init
# Sample Output for Reference
PS C:\Users\Administrator\Downloads\hashicorp-certified-terraform-associate-on-azure-main\hashicorp-certified-terraform-associate-on-azure-main\66-Terraform-CLI-Config-File-WindowsOS\terraform-manifests> terraform init
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/external versions matching ">= 2.0.0"...
- Finding hashicorp/azurerm versions matching ">= 2.0.0"...
- Finding hashicorp/random versions matching ">= 3.0.0"...
- Using hashicorp/random v3.1.0 from the shared cache directory
- Using hashicorp/external v2.1.0 from the shared cache directory
- Using hashicorp/azurerm v2.65.0 from the shared cache directory
Step-07: Clean-Up¶
# Remove .terraform Folder which contains plugins
Delete folder .terraform and file: .terraform.lock.hcl
🎉 New Course
Ultimate DevOps Real-World Project Implementation on AWS
$15.99
$84.99
81% OFF
MARCH2026
Enroll Now on Udemy →
🎉 Offer