Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: data.github_user.ssh_keys - Allow returning the key ID as well #2208

Open
1 task done
fkonradmain opened this issue Mar 23, 2024 · 0 comments
Open
1 task done
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Feature New feature or request

Comments

@fkonradmain
Copy link

fkonradmain commented Mar 23, 2024

Describe the need

When this provider is used to retrieve the public ssh keys of a user, it only provides a list of ssh keys, as you would get when calling:

curl -L \
  -H "Accept: text/plain" \
  https://github.com/<username>.keys

This list only cotains the ssh key list, but it does not deliver any ids. Although it seems to be sorted by key id.

The result looks like this:

[
  "ssh-rsa AAAASsdafasdfsadlewwelrwerwerwlerkwjerlkwerlw...",
  "ssh-ed25519 AAAASsdafasdfsdfsdfsdfeefefwsc322323asddfsadl...",
]

Yet, when calling the api, we can also retrieve the SSH Key id. Api Documentation Link

curl -L \
  -H "Accept: application/vnd.github+json" \
  # -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/users/USERNAME/keys

My feature request is the ability to retrieve this key id through the terraform provider as well. This would provide the possiblity to safely iterate through the list of ssh keys and it would also provide the chance to address each key individually.

This would make the result look like this:

[
  {
    id = 11111111
    key = "ssh-rsa AAAASsdafasdfsadlewwelrwerwerwlerkwjerlkwerlw...",
  },
  {
    id = 11112222
    key = "ssh-ed25519 AAAASsdafasdfsdfsdfsdfeefefwsc322323asddfsadl...",
  }
]

This would also change the data type of the result from list(string) to list(map(string)).

Since this is a breaking change (unless terraform introduces a map default type that is returned, when addressing a map directly), it should be realized through an additional api call.

Thank you very much.

SDK Version

6.2.0

API Version

2022-11-28

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@fkonradmain fkonradmain added Status: Triage This is being looked at and prioritized Type: Feature New feature or request labels Mar 23, 2024
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants