Terraform modules that provisions cloud resources within the Google Cloud Platform (GCP) Free Tier limits.
DISCLAIMER: The author of this project does not guarantee that you will not incur charges with GCP if you use this project.
Create a GCP account and project at https://console.cloud.google.com.
In that project, creat a Service Account for the project with the following roles attached:
- Compute Public IP Admin
- Compute Instance Admin
- Compute Network Admin
- Compute Security Admin
- Monitoring Admin
Set the following environment variables for the google
Terraform provider:
GOOGLE_REGION
- Must be one ofus-west1
,us-central1
,us-east1
to fall within the free tier limit requirements. Choose whichever is physically closest to you.GOOGLE_PROJECT
- Your Google Cloud Platform project id.GOOGLE_CREDENTIALS
- Contents of a service account key file in JSON format. You can manage key files using the Cloud Console. See the full reference for more details.
See examples.tf
for example implementations of all the modules.
In addition to the environment variables listed above, the examples expect the following env vars:
TF_VAR_GCE_ZONE
TF_VAR_SSH_PUBKEY_FILE
TF_VAR_SSH_USER
TF_VAR_NOTIFICATION_CHANNEL_NAME
(Optional; set if you want to receive alerts when on track to exceed free tier thresholds)
Provisions an f1-micro
Google Compute Cloud instance that can run 24x7 while not incurring charges. Be aware that there are data transfer limits in order to stay in the free tier.
This instance has firewall rules that allow inbound traffic for SSH (port 22), HTTP/HTTPS (ports 80 and 443), and DNS (port 53)
This module requires the following variables provided to it:
gce_zone
- A zone in the region you've configured inGOOGLE_REGION
; usually${GOOGLE_REGION}-a
(or-b
or-c
).gce_ssh_pubkey_file
- A public SSH key used to connect to the instancegce_ssh_user
- Your SSH user