-
providers.tf
Description: Theproviders.tf
file is used to configure and declare provider settings in Terraform. Providers enable Terraform to interact with cloud platforms (e.g., AWS, Azure, GCP) or other services. This file specifies provider versions, regions, and authentication methods. -
variables.tf
Description: Thevariables.tf
file defines input variables for Terraform configurations. These variables allow parameterization of values like resource names, regions, or instance types, making configurations more reusable and dynamic. -
outputs.tf
Description: Theoutputs.tf
file is used to expose the results of a Terraform run. It outputs values, such as IP addresses, URLs, or resource attributes, for use by other configurations, tools, or workflows. -
main.tf
Description: Themain.tf
file serves as the core configuration file in Terraform. It typically contains the main resource definitions and logic for creating and managing infrastructure resources. -
terraform.tfvars
Description: Theterraform.tfvars
file is used to define variable values for Terraform configurations. By separating variable values from the configuration files, it allows for better management and flexibility across different environments. -
backend.tf
Description: Thebackend.tf
file configures the backend for Terraform's state management. It specifies where the state file is stored, such as in an S3 bucket or a local file, ensuring proper tracking and collaboration. -
data.tf
Description: Thedata.tf
file is used to define data sources in Terraform. Data sources allow Terraform to fetch or reference existing resources without creating new ones, enabling integration with pre-existing infrastructure. -
locals.tf
Description: Thelocals.tf
file is used to define local values that simplify and group expressions in Terraform. These local values are reusable throughout the configuration for better readability and maintainability. -
modules/
Description: Themodules/
directory contains reusable modules in Terraform. Modules encapsulate groups of resources and logic, enabling modular, DRY (Don't Repeat Yourself) practices for complex configurations. -
versions.tf
Description: Theversions.tf
file is used to specify required versions for Terraform and its providers. This ensures compatibility and avoids unintended behavior caused by version mismatches. -
environment.tfvars
Description: Theenvironment.tfvars
file is typically used to define environment-specific variable overrides. It allows configurations to adapt to environments like development, staging, or production. -
terraform.lock.hcl
Description: Theterraform.lock.hcl
file is an auto-generated dependency lock file. It ensures that Terraform uses the same dependency versions across runs, improving consistency and reducing unexpected changes. -
init.sh
Description: Theinit.sh
file is a custom script that may be used to automate the initialization of Terraform configurations, including commands liketerraform init
and setting up required environment variables.
Created
April 17, 2025 17:10
-
-
Save pizofreude/1d77dc0a217d175fa195988e62b0146e to your computer and use it in GitHub Desktop.
Terraform Code Artifacts and Descriptions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.gitignore
for TerraformWhen working with Terraform, you should include the following items in your
.gitignore
file to avoid committing sensitive data, temporary files, and unnecessary state-related files to your repository:Explanation of the entries:
.terraform/
: The directory where Terraform downloads provider plugins and stores temporary files. This is system-specific and should not be committed..terraform.lock.hcl
: The dependency lock file. While optional, it is generally a good practice to commit this file to ensure consistent provider versions, but you may choose to ignore it in specific cases.*.tfstate
and*.tfstate.backup
: State files that store the current state of your infrastructure. These files often contain sensitive information (e.g., secrets, IDs) and should never be committed.crash.log
: Logs generated when Terraform crashes. Useful for debugging but not relevant to version control.*.tfvars
and*.tfvars.json
: Files used to define variable values, often containing sensitive data like passwords or API keys.*.auto.tfvars
and*.auto.tfvars.json
: Automatically loaded variable files, often containing sensitive configuration data.*.tfplan
: Files generated byterraform plan
commands for storing execution plans. These are ephemeral and not required for version control..DS_Store
,Thumbs.db
, or*.swp
are generated by text editors or operating systems and should be ignored.This
.gitignore
ensures that sensitive information and unnecessary files are excluded from your repository. Let me know if you'd like any clarifications or additions!