= Terraform Override File =
**Summary**: This wiki page shows how to use terraform override files to make it more convenient to work locally. \\
**Date**: 1 January 2026 \\
{{tag>terraform}}
I use terraform override files to test my terraform code which I make publicly available. This allows me to really test the code and make sure all of the small errors and mistakes are gone, and the code is ready for use. There are several use cases for using override files, but as the [[https://developer.hashicorp.com/terraform/language/files/override |documentation]] says, use them sparingly.
== Example for Local Usage ==
Below is an example of my most common override file. It simply contains the provider block info for the Entra ID appliction (created as explained [[terraform|here]]), and an extra variable to override the default subscription to deploy to:
provider "azurerm" {
subscription_id = "30b3c71d-a123-a123-a123-abcd12345678"
client_id = "dc7442e8-5855-4032-b831-ae287e40aca9"
client_secret = "***"
tenant_id = "7e4an71d-a123-a123-a123-abcd12345678"
features {}
}
variable "env_subscription_id" {
default = "30b3c71d-a123-a123-a123-abcd12345678"
}
To use this, first make sure to add override files to your .gitignore, so you don't accidentally commit them with sensitive info:
# Ignore override files as they are usually used to override resources locally
override.tf
override.tf.json
*_override.tf
*_override.tf.json
Next, add the override file to your terraform project folder, and run terraform as usual. The override file will be automatically picked up by terraform, merged into the configuration and used to override any existing resources or variables.
//This wiki has been made possible by://