A separate and dedicated Google Cloud project is created and set up.
Note Do not use a project that has already been created. Terraform creates a new project for us.
Create variable file terraform.tfvars
:
# Google Cloud project ID
# Changing this forces a new project to be created
project = "[PROJECT_ID]"
# The alphanumeric ID of the billing account this project belongs to
billing_account = "[BILLING_ACCOUNT_ID]"
# The numeric ID of the folder this project should be created under
folder = "[FOLDER_ID]"
# Google Cloud DNS domain name suffix for managed zone
# This domain is used for the VMs
# Name field must end with trailing dot, for example myzone.example.com. (note the trailing dot)
dns-domain = "subdomain.domain.tld."
Please verify the ownership of the domain (or a parent) at http://www.google.com/webmasters/verification/.
-
To initiate authorization, enter the following command:
gcloud auth application-default login --no-launch-browser
-
Copy the long URL that begins with
https://accounts.google.com/o/oauth2/auth...
-
Paste this URL into the browser with which you are currently logged in with your admin account.
-
Copy the authorization code from the web browser.
-
Paste the authorization code back to the prompt, "Enter authorization code", and press Enter to complete the authorization.
gcloud auth application-default set-quota-project [EXISTING-GOOGLE-PROJECT]
terraform init
terraform apply
Copy variables.sh
and pi-private-key.json
to pi
directory:
cp variables.sh ../pi/
cp pi-private-key.json ../pi/
Add all name servers from file dns-name-servers.txt
to your DNS (registrar setup) as type NS.
cat dns-name-servers.txt
Example of configuration with Cloudflare DNS management and domain name (dns-domain
) suffix soda.nkn-it.de.
:
Repeat with all four DNS servers.
Test:
dig ns soda.nkn-it.de
Copy this repo to Google Cloud Source.
-
Add Cloud Source repository as remote repo:
bash sourcerepo-url.sh
-
Push:
git push cloudsource
-
View repository:
If you want to log out again, follow these steps: Revoke cookies
After pushing this repo to Google Cloud Source, a Google Cloud Build is triggered that creates the custom OS images.
List OS images:
gcloud compute images list \
--no-standard-images \
--project [YOUR-GOOGLE-CLOUD-PROJECT]
Output:
NAME FAMILY STATUS
custom-debian debian-12 READY
custom-fedora fedora-cloud-38 READY
custom-suse opensuse-leap READY
custom-ubuntu ubuntu-2204-lts READY
Your Google Cloud Platform is now configured. Continue with the Raspberry Pi.
cd ../pi/
If you want to delete everything, Terraform can destroy everything for you:
terraform apply -destroy
rm -rf .terraform .terraform.lock.hcl terraform.tfstate
Because everything is set up in an extra project, you can also just delete the whole project.