An open API service indexing awesome lists of open source software.

https://github.com/micromaomao/cloud-vm-dns-sync

A small go script to automatically add Cloudflare DNS records for gcp cloud servers.
https://github.com/micromaomao/cloud-vm-dns-sync

Last synced: about 2 months ago
JSON representation

A small go script to automatically add Cloudflare DNS records for gcp cloud servers.

Awesome Lists containing this project

README

        

## Function

This script does the following for each of your GCP Compute instances:

1. Get the PTR record configuration (in network interface tab)
2. Get its current IP, or nothing if it is powered off.
3. Create the corrosponding DNS records in your cloudflare zone based on the domain name in the PTR, and the IP of the instance, or delete the record if the machine is off.

## Usage

1. Create a file named something like `cloudflare-cred.ini`, and populate it with the following:


dns_cloudflare_api_token = your cloudflare API token

2. Create a service account with the "Compute Viewer" role, and download their GCP credential to a JSON file.

3. Run the script with the following environment variables:


CLOUDFLARE_INI=location of the file created in step 1
GOOGLE_APPLICATION_CREDENTIALS=location of the file created in step 2