-
Notifications
You must be signed in to change notification settings - Fork 948
GitHub EMU external groups data source #1145
Description
Hi there,
Terraform Version
Terraform v1.1.9
on linux_amd64
+ provider registry.terraform.io/integrations/github v4.25.0-alphaAffected Resource(s)
- github_emu_group_mapping
Expected Behavior
The GitHub Terraform provider should provide a data source to retrieve the GitHub EMU external groups group_id attribute so we can use it with the github_emu_group_mapping resource.
Actual Behavior
Actually the GitHub Terraform provider only provides the data source github_organization_team_sync_groups that does not work with GitHub EMU external groups. An alternative is to retrieve the external groups with the http data source and use the body of the HTTP response to create the external groups group_id attribute reference.
For example, we can create a data source and a local containing all the external groups attributes (group_name, group_id, updated_at) like that:
data "http" "external_groups" {
url = "https://api.github.com/orgs/${var.github_org}/external-groups"
request_headers = {
Accept = "application/vnd.github.v3+json"
Authorization = "Bearer ${var.github_token}"
}
}
locals {
external_groups = jsondecode(data.http.external_groups.body)["groups"]
}This should give us what we need but it would be far way better to get the attributes reference from a provider data source instead of having to deal with the raw body HTTP response coming from the REST API.