Skip to content

Commit

Permalink
Set node_id in github_organization data source (integrations#1277)
Browse files Browse the repository at this point in the history
* fix: add missing node_id

* test: check for all fields in schema

* doc: add id, node_id, and orgname

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
  • Loading branch information
douglascayers and kfcampbell committed Sep 19, 2022
1 parent a39fe4b commit cc3c17f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions github/data_source_github_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func dataSourceGithubOrganizationRead(d *schema.ResourceData, meta interface{})
d.Set("login", organization.GetLogin())
d.Set("name", organization.GetName())
d.Set("orgname", name)
d.Set("node_id", organization.GetNodeID())
d.Set("description", organization.GetDescription())
d.Set("plan", planName)
d.Set("repositories", repoList)
Expand Down
2 changes: 2 additions & 0 deletions github/data_source_github_organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func TestAccGithubOrganizationDataSource(t *testing.T) {
check := resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.github_organization.test", "login", testOrganization),
resource.TestCheckResourceAttrSet("data.github_organization.test", "name"),
resource.TestCheckResourceAttrSet("data.github_organization.test", "orgname"),
resource.TestCheckResourceAttrSet("data.github_organization.test", "node_id"),
resource.TestCheckResourceAttrSet("data.github_organization.test", "description"),
resource.TestCheckResourceAttrSet("data.github_organization.test", "plan"),
resource.TestCheckResourceAttrSet("data.github_organization.test", "repositories.#"),
Expand Down
7 changes: 5 additions & 2 deletions website/docs/d/organization.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ Use this data source to retrieve basic information about a GitHub Organization.
## Example Usage

```hcl
data "github_organization" "test" {
data "github_organization" "example" {
name = "github"
}
```

## Attributes Reference

* `name` - The name of the organization account
* `id` - The ID of the organization
* `node_id` - GraphQL global node id for use with v4 API
* `name` - The organization's public profile name
* `orgname` - The organization's name as used in URLs and the API
* `login` - The login of the organization account
* `description` - The description the organization account
* `plan` - The plan name for the organization account
Expand Down

0 comments on commit cc3c17f

Please sign in to comment.