diff --git a/provider.go b/provider.go index a2fc6d5f..e496b4ee 100644 --- a/provider.go +++ b/provider.go @@ -22,9 +22,12 @@ func Provider() terraform.ResourceProvider { }, "credentials": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - DefaultFunc: schema.EnvDefaultFunc("GOOGLE_CREDENTIALS", nil), + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE_JSON", + }, nil), ValidateFunc: validateCredentials, }, diff --git a/provider_test.go b/provider_test.go index 1be00829..9bf5414b 100644 --- a/provider_test.go +++ b/provider_test.go @@ -39,7 +39,9 @@ func testAccPreCheck(t *testing.T) { } if v := os.Getenv("GOOGLE_CREDENTIALS"); v == "" { - t.Fatal("GOOGLE_CREDENTIALS must be set for acceptance tests") + if w := os.Getenv("GOOGLE_CLOUD_KEYFILE_JSON"); w == "" { + t.Fatal("GOOGLE_CREDENTIALS or GOOGLE_CLOUD_KEYFILE_JSON must be set for acceptance tests") + } } if v := os.Getenv("GOOGLE_PROJECT"); v == "" {