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

Set node_id in github_organization data source #1277

Merged
merged 5 commits into from
Sep 19, 2022
Merged

Set node_id in github_organization data source #1277

merged 5 commits into from
Sep 19, 2022

Conversation

douglascayers
Copy link
Contributor

Summary

The github/data_source_github_organization.go defines a node_id (String) in its schema but the code doesn't actually output that value. This PR fixes that.

Changes

  • Update the dataSourceGithubOrganizationRead function to set the node_id value in the generated result.
  • Update unit test to check for all fields in the expected schema.
  • Update documentation to describe id, node_id, and orgname properties exposed in the schema.

Usage

Example configuration:

data "github_organization" "org" {
  name = "integrations"
}

Example output:

{
  "resources": [
    {
      "mode": "data",
      "type": "github_organization",
      "name": "org",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "description": "Integrations built and run by GitHub. If you're looking for more GitHub integrations, see https://github.com/marketplace",
            "id": "84390928",
            "login": "integrations",
            "members": [
              "octocat",
              "kfcampbell"
            ],
            "name": "GitHub integrations",
            "node_id": "MDEyOk9yJ7FuvXpydGlpbjg2NGkwOTE3",
            "orgname": "integrations",
            "plan": "enterprise",
            "repositories": [
              "integrations/terraform-provider-github",
              "integrations/slack"
            ]
          },
          "sensitive_attributes": []
        }
      ]
    }
  ]
}

@douglascayers
Copy link
Contributor Author

Hi @kfcampbell, would appreciate your review of this PR to populate node_id when reading organizations. Thanks!

Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating the test and documentation as well!

@kfcampbell kfcampbell merged commit 3724f74 into integrations:main Sep 19, 2022
@douglascayers douglascayers deleted the data-source-github-organization branch September 19, 2022 20:56
kazaker pushed a commit to auto1-oss/terraform-provider-github that referenced this pull request Dec 28, 2022
* 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>
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants