Terraform - Base Dir Format
+42 · 5 files changed
-
terraform/README.md+42 −0 -
terraform/outputs.tf+0 −0 -
terraform/terraform.tfvars+0 −0 -
terraform/variables.tf+0 −0 -
terraform/versions.tf+0 −0
@@ -0,0 +1,42 @@ +. +├── main.tf # Entry point of the Terraform configuration, often contains provider configuration +├── variables.tf # Defines variables used across the project +├── outputs.tf # Defines outputs from your Terraform configuration +├── terraform.tfvars # Contains values for the defined variables +├── backend.tf # (Optional) Contains backend configuration for state management +├── versions.tf # Sets the Terraform version and provider requirements +├── README.md # Project documentation for maintainers and users +└── modules/ + ├── network/ # Network module, e.g., VNets, subnets, NSGs + │ ├── main.tf + │ ├── variables.tf + │ ├── outputs.tf + │ └── ... + ├── compute/ # Compute module, e.g., VMs, scale sets + │ ├── main.tf + │ ├── variables.tf + │ ├── outputs.tf + │ └── ... + └── storage/ # Storage module, e.g., blob storage, disk + ├── main.tf + ├── variables.tf + ├── outputs.tf + └── ... + +File and Directory Roles + + main.tf: This is often the entry point for Terraform configurations. In the root directory, it might contain provider configurations and module invocations. Within modules, it contains the main set of resources that module manages. + + variables.tf: Defines variables for the module or root configurations, making your configurations flexible and reusable. + + outputs.tf: Defines output values that you can use to retrieve information about the resources, such as IDs or endpoints, and can be used by other configurations or modules. + + terraform.tfvars: Contains actual values for the declared variables. Sensitive values should not be committed to version control, so consider using environment variables or encrypted secrets management for those. + + backend.tf: Optionally specifies backend configuration where Terraform state information is stored. This is crucial for team environments or when using Terraform in automation (CI/CD pipelines). + + versions.tf: Specifies required versions for Terraform and providers, ensuring consistent behavior across different environments and team members. + + README.md: Provides documentation for your project, explaining its purpose, how to use it, and any prerequisites or configuration steps. + + Modules Directory: Contains subdirectories for each modularized component of your infrastructure, like networking or compute resources. This allows you to encapsulate and reuse configurations. \ No newline at end of file