Auto-update GCP firewall rule for a dynamic source IP
gcloud functions deploy checkip --runtime python37 --trigger-http --memory=128MB
availableMemoryMb: 128
entryPoint: checkip
httpsTrigger:
url: https://us-central1-tjwebb-test-project.cloudfunctions.net/checkip
gcloud beta auth application-default login
python update_firewall.py REGION PROJECT_ID RULE_ID
Your ip: 70.199.120.85
Replaced 70.199.148.46 with 70.199.120.85 in rule [ test-rule ]
Done.
REGION
is the region in which you deployed your checkip
function.
gcloud beta auth application-default login
python find_firewall_ip.py IP_ADDRESS