I am trying to setup Caddy to use Googlecloud DNS on my GCP VM.
Looking at the docs, I need to setup these env vars:
- GCE_PROJECT
- GCE_DOMAIN
- GOOGLE_APPLICATION_CREDENTIALS
- (or GCE_SERVICE_ACCOUNT_FILE)
I have used the vultr
DNS plugin in the past and it worked fine, Caddy runs as the http
user on the Arch linux VM.
$ sudo -u http echo $GCE_PROJECT
Asia Wg server
$ sudo -u http echo $GCE_DOMAIN
wsrpna.io
$ sudo -u http echo $GCE_SERVICE_ACCOUNT_FILE
/etc/caddy/gcp.json
$ sudo -u http echo $GOOGLE_APPLICATION_CREDENTIALS
/etc/caddy/gcp.json
$ ls -l /etc/caddy/gcp.json
-rw-r--r-- 1 http http 2347 Mar 8 13:26 /etc/caddy/gcp.json
$ sudo -u http cat /etc/caddy/gcp.json
{
"type": "service_account",
"project_id": "Asia-Wg-server",
"private_key_id": "XXX",
"private_key": "-----BEGIN PRIVATE KEY-----
***snipped***
}
Caddy error:
Mar 10 18:48:52 systemd[1]: Started Caddy HTTP/2 web server.
Mar 10 18:48:53 caddy[285]: 2019/03/10 18:48:53 [INFO][FileStorage:/var/lib/caddy] Started certificate maintenance routine
Mar 10 18:48:53 caddy[285]: 2019/03/10 18:48:53 /etc/caddy/caddy.conf.d/smokeping.conf:162 - Error during parsing: Setting up DNS provider 'googlecloud': googlecloud: project name missing
Mar 10 18:48:53 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Mar 10 18:48:53 systemd[1]: caddy.service: Failed with result 'exit-code'.
I have tried setting GCE_PROJECT to the Project Name and Project ID, the error remains.
It appears the http
user can see the env vars and read the credential json, what am I missing here?