Skip to content

feat: use provider owner as default for github_organization data source#3316

Open
mattias-fjellstrom wants to merge 2 commits intointegrations:mainfrom
mattias-fjellstrom:mattias-fjellstrom/org-datasource-owner-fallback
Open

feat: use provider owner as default for github_organization data source#3316
mattias-fjellstrom wants to merge 2 commits intointegrations:mainfrom
mattias-fjellstrom:mattias-fjellstrom/org-datasource-owner-fallback

Conversation

@mattias-fjellstrom
Copy link
Copy Markdown

Summary

When no name is provided to the github_organization data source, it now falls back to the provider's configured owner (or the authenticated user if no owner is set). This makes name optional.

Motivation

Users who already configure an owner in the provider block shouldn't need to repeat it in every github_organization data source. This is consistent with how other data sources in this provider handle the owner fallback.

Changes

  • github/data_source_github_organization.go: changed name from Required to Optional+Computed, and fall back to meta.(*Owner).name when not supplied
  • github/data_source_github_organization_test.go: added acceptance test verifying the fallback behaviour
  • website/docs/d/organization.html.markdown: updated docs to reflect name is now optional, with a second example showing omitted name

Example

Before (name was required):

data "github_organization" "example" {
  name = "my-org"
}

After (name is falls back to provider owner):optional

provider "github" {
  owner = "my-org"
}

data "github_organization" "example" {}

Testing

All acceptance tests pass:

  • uses_provider_owner_when_name_is_not_set (new)
  • queries_for_an_organization_without_error
  • queries_for_an_organization_with_archived_repos
  • queries_for_an_organization_summary_only_without_error

When no 'name' is provided, fall back to the provider's configured
owner (or the authenticated user). This makes 'name' optional.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

Verify that omitting 'name' from the data source falls back to the
provider's configured owner.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattias-fjellstrom mattias-fjellstrom force-pushed the mattias-fjellstrom/org-datasource-owner-fallback branch from 92130b5 to 09ec3a0 Compare April 2, 2026 13:30
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