terraform-provider-github
terraform-provider-github copied to clipboard
GitHub EMU external groups data source
Hi there,
Terraform Version
Terraform v1.1.9
on linux_amd64
+ provider registry.terraform.io/integrations/github v4.25.0-alpha
Affected 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.
@kfcampbell Do we have an ETA of when the 4.27.0 will be out ?
I've updated #1185 a bit today, and hopefully will wrap this up next week.