This repo contains Terraform configurations (in the tfinfra
dir) for setting up cloud resources. The structure uses modularized .tf
files for efficient and reusable infrastructure as code.
- Google Cloud Shell and project access
-
Open your Cloud Shell
-
Create a Directory for Configuration Files:
mkdir path/to/your_dir_name cd path/to/your_dir_name
-
Initialize Terraform:
terraform init
-
Create Configurations:
Create
.tf
configuration files for all required resources, usetouch
andnano
or any other convenient tools. Organize these files using nested folders for modules, which are containers for reusable configurations. For instance, use theinstance
directory for Virtual Machines (VMs). -
Format Configuration Files:
To format the Terraform configuration files to a canonical format and style, run:
terraform fmt
-
Initialize Terraform:
terraform init
-
Create an Execution Plan:
terraform plan
-
Apply Changes:
terraform apply
You can use it as a start simple template for your infrastructure. For more details see the Terraform documentation
Any advice or contributions are welcome!