Automatrix is a deterministic, infinitely scalable automation framework that fuses Terraform and Ansible to provision, configure, and maintain GCP Free-Tier VMs with absolute precision. Built on immutable infrastructure and idempotent execution, it guarantees every deployment is identical and flawlessly repeatable.
1. Install & Configure Cloud CLI (https://cloud.google.com/sdk/docs/install)
mv ~/Downloads/google-cloud-cli-darwin-arm.tar.gz .
tar -zxf google-cloud-cli-darwin-arm.tar.gz
rm google-cloud-cli-darwin-arm.tar.gz
rm ~/google-cloud-sdk
mv google-cloud-sdk ~/
cd ~/google-cloud-sdk
./install.sh
unset GOOGLE_APPLICATION_CREDENTIALS
gcloud config unset project
gcloud auth application-default revoke
gcloud auth application-default login
ssh-keygen -R free-tier-vm
2. Install Terraform (https://developer.hashicorp.com/terraform/install?product_intent=terraform)
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
locals {
# gcloud beta billing accounts list
billing_account = "<billing_account>"
project_id = "<project_id>"
project_name = "<project_name>"
region = "us-central1"
zone = "us-central1-a"
instance_name = "free-tier-vm"
machine_type = "e2-micro"
image = "debian-cloud/debian-11"
disk_size = 30
disk_type = "pd-standard"
ansible_user = "<ansible_user>"
apis = [
"compute.googleapis.com",
"container.googleapis.com",
"logging.googleapis.com",
"secretmanager.googleapis.com",
"networkmanagement.googleapis.com"
]
}
terraform fmt
terraform init
terraform validate
terraform plan
terraform apply -auto-approve
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install ansible google-auth requests
gcloud compute ssh free-tier-vm --zone=us-central1-a --tunnel-through-iap --project=$(terraform output -raw project_id)
ansible-playbook site.yaml
ansible-playbook site.yaml --tags "file_analysis"
./run_tests.sh
cat report.log