Terraform Starter Pack AWS Infrastructure as Terraform scripts
# Copy the terraform.tfvars.example to terraform.tfvars
cp terraform.tfvars.example terraform.tfvars
# Enter the correct credentials in terraform.tfvars
# To initialize a module
terraform init
# To plan changes
terraform plan -var-file=terraform.tfvars
# To apply your changes to the infrastructure
terraform apply -var-file=terraform.tfvars
# To plan on destroying your infrastructure
terraform plan -destroy -var-file=terraform.tfvars
# To destroy your infrastucture
terraform destroy -var-file=terraform.tfvars
├── backend.tf
├── main.tf
├── modules
│ ├── global
│ └── projects
├── output.tf
├── provider.tf
├── README.md
├── terraform.tfvars
└── variables.tf
terraform init
is necessary to be executed if any new module is added- Project Specific Module will lie inside
modules/project/<project_name>
- Project Module will have the following structure:
project_name
├── dev
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── prod
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── uat
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── main.tf
├── outputs.tf
└── variables.tf
- Global Modules will lie inside
modules/global/<module_name>
- Global Module will have the following structure
module_name
├── main.tf
├── output.tf
└── variables.tf
main.tf
will include the terraform scripts necessary to initialize the modulevariables.tf
will include the variables used bymain.tf
outputs.tf
will include outputs generated by `main.tf