diff --git a/github/config.go b/github/config.go index ca6d178ce3..42a0cdc499 100644 --- a/github/config.go +++ b/github/config.go @@ -2,6 +2,7 @@ package github import ( "context" + "log" "net/http" "net/url" "path" @@ -148,9 +149,14 @@ func (c *Config) Meta() (interface{}, error) { owner.v3client = v3client if c.Anonymous() { + log.Printf("[DEBUG] No token present; configuring anonymous owner.") return &owner, nil } else { - return c.ConfigureOwner(&owner) + _, err = c.ConfigureOwner(&owner) + if err != nil { + return &owner, err + } + log.Printf("[DEBUG] Token present; configuring authenticated owner: %s", owner.name) + return &owner, nil } - } diff --git a/github/provider.go b/github/provider.go index cb5ed60083..dc1878f2e8 100644 --- a/github/provider.go +++ b/github/provider.go @@ -2,6 +2,7 @@ package github import ( "fmt" + "log" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" @@ -182,6 +183,7 @@ func providerConfigure(p *schema.Provider) schema.ConfigureFunc { org := d.Get("organization").(string) if org != "" { + log.Printf("[DEBUG] Selecting organization attribute as owner: %s", org) owner = org } diff --git a/github/provider_utils.go b/github/provider_utils.go index 5e1399ebda..3672c7508d 100644 --- a/github/provider_utils.go +++ b/github/provider_utils.go @@ -2,6 +2,7 @@ package github import ( "fmt" + "log" "os" "testing" ) @@ -97,9 +98,12 @@ func testAccCheckOrganization() error { func OwnerOrOrgEnvDefaultFunc() (interface{}, error) { if organization := os.Getenv("GITHUB_ORGANIZATION"); organization != "" { + log.Printf("[DEBUG] Selecting owner %s from GITHUB_ORGANIZATION environment variable", organization) return organization, nil } - return os.Getenv("GITHUB_OWNER"), nil + owner := os.Getenv("GITHUB_OWNER") + log.Printf("[DEBUG] Selecting owner %s from GITHUB_OWNER environment variable", owner) + return owner, nil } func testOrganizationFunc() string {