This project uses the Terraform to provide and manage GCP resources. The goal is to automate the creation, modification and deletion of a simple infraestructure described below, ensuring a scalable and repeatable infrastructure.
For each environment,
main.tf
: Defines the main resources such as VM instances, networks, subnetworks and etc.variables.tf
: Declares the variables used in the project, including the specification about their type and default values.outputs.tf
: Defines the outputs, which can be available for other Terraform's modules or just for view.provider.tf
: Setup the GCP (Google Cloud Plataform) provider and your credentials.terraform.tfvars
: File used to specify the variable values, overwriting the default values at variables.tf
.Install Terraform:
Create a Project at GCP:
Create a Service Account to allow Terraform code to apply changes. Make sure to assign the following roles:
Running code locally. Go to /code/environments/dev/
terraform init
terraform fmt -recursive
terraform validate
terraform plan
terraform apply
The image below describe the most of principal resources provisioned by Terraform.