Skip to content

github_user data source should support current authenticated user #260

@mithun

Description

@mithun

Terraform Version

$ terraform version
Terraform v0.12.5
+ provider.github v2.2.0

Affected Resource(s)

  • github_user data source

Terraform Configuration Files

provider "github" {
  individual = true
  version    = "2.2.0"
}

data "github_user" "current" {
  username = ""
}

output "github_current_login" {
  value = data.github_user.current.login
}

Expected Behavior

The current authenticated user's github login is printed as a terraform output.

Actual Behavior

$ terraform apply
data.github_user.current: Refreshing state...

Error: GET https://api.github.com/user/gpg_keys: 404 Not Found []

  on main.tf line 6, in data "github_user" "current":
   6: data "github_user" "current" {

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

go-github/v27 allows using an empty string for the username to fetch the current user's details. This API call seems successful. However, the API calls to get GPG and SSH seems to be using the username argument which can be an empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions