Created
August 26, 2022 01:48
-
-
Save pjaudiomv/a564885cc2e276125ad89057457d4055 to your computer and use it in GitHub Desktop.
GitHub User SSH Keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "http" "users" { | |
for_each = toset(var.github_users) | |
url = "https://api.github.com/users/${each.value}/keys" | |
request_headers = { | |
Accept = "application/json" | |
} | |
} | |
variable "github_users" { | |
type = list(string) | |
default = ["gh_username_a", "gh_username_b"] | |
} | |
output "ssh_keys" { | |
value = yamlencode([for i in data.http.users : jsondecode(i.response_body).0.key]) | |
} | |
# #cloud-config | |
# | |
# ssh_authorized_keys: | |
# ${yamlencode([for i in data.http.users : jsondecode(i.response_body).0.key])} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment