diff --git a/CHANGELOG.md b/CHANGELOG.md index 66015e361e..76cdd0369c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + - Google Provider: Add auto-detection of Google Project when running on GCP (#492) @drzero42 - Add custom TTL support for DNSimple (#477) @jbowes - Fix docker build and delete vendor files which were not deleted (#473) @njuettner - DigitalOcean: DigitalOcean creates entries with host in them twice (#459) @njuettner diff --git a/provider/google.go b/provider/google.go index c1b6b2b8d9..e7a2a93409 100644 --- a/provider/google.go +++ b/provider/google.go @@ -21,6 +21,7 @@ import ( "sort" "strings" + "cloud.google.com/go/compute/metadata" "github.com/linki/instrumented_http" log "github.com/sirupsen/logrus" @@ -133,6 +134,14 @@ func NewGoogleProvider(project string, domainFilter DomainFilter, zoneIDFilter Z return nil, err } + if project == "" { + mProject, mErr := metadata.ProjectID() + if mErr == nil { + log.Infof("Google project auto-detected: %s", mProject) + project = mProject + } + } + provider := &GoogleProvider{ project: project, domainFilter: domainFilter,