Introduction
Sometimes you want to keep your settings secret or change them without editing files. Environment variables let you do this by storing values outside your code. Terraform uses special environment variables starting with TF_VAR_ to set input variables automatically.
When you want to keep sensitive data like passwords out of your Terraform files.
When you need to change variable values quickly without editing the Terraform configuration.
When running Terraform in automated scripts or pipelines where variables come from the environment.
When sharing Terraform code but want each user to provide their own settings.
When you want to avoid committing secrets to version control.