https://github.com/tungbq/terraform-sample-project
Sample Terraform project with best practice
https://github.com/tungbq/terraform-sample-project
Last synced: 3 months ago
JSON representation
Sample Terraform project with best practice
- Host: GitHub
- URL: https://github.com/tungbq/terraform-sample-project
- Owner: tungbq
- Created: 2023-12-09T03:48:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-09T04:03:34.000Z (almost 2 years ago)
- Last Synced: 2025-07-19T09:29:43.394Z (3 months ago)
- Language: HCL
- Size: 9.77 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# terraform-sample-project
Sample Terraform project with best practice```
terraform-project/
│
├── main.tf
├── variables.tf
├── outputs.tf
│
├── modules/
│ ├── example_module/
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── outputs.tf
├── environments/
│ ├── prod/
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── outputs.tf
│ │
│ └── dev/
│ ├── main.tf
│ ├── variables.tf
│ └── outputs.tf
│
├── providers.tf
├── terraform.tfvars
└── backend.tf
```# Project Structure Description
### 1. Root Level
- `main.tf`: Main configuration for the overall infrastructure.
- `variables.tf`: Declaration of variables used throughout the project.
- `outputs.tf`: Definition of output values to be extracted and used elsewhere.
- `providers.tf`: Provider configurations for AWS or any other providers.
- `terraform.tfvars`: Storage for non-sensitive variables or overrides default values.
- `backend.tf`: Specification of the backend configuration for remote state storage.### 2. Modules
- `example_module/`: The example module.Each module contains:
- `main.tf`: Configuration for that specific module.
- `variables.tf`: Module-specific variables.
- `outputs.tf`: Output values specific to that module.### 3. Environments
- `prod/`: Environment-specific configurations for production.
- `dev/`: Environment-specific configurations for development.Each environment includes:
- `main.tf`: Configuration specific to that environment.
- `variables.tf`: Environment-specific variables.
- `outputs.tf`: Environment-specific outputs.