From ebef8e2e32e7c37f3aa94f6aa17d923bcfdcd555 Mon Sep 17 00:00:00 2001 From: "Chris W. Gerber" Date: Wed, 5 Jan 2022 12:24:17 -0600 Subject: [PATCH] Handles nil plan in org data source (#1016) Co-authored-by: Chris Gerber --- github/data_source_github_organization.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/github/data_source_github_organization.go b/github/data_source_github_organization.go index 6dbf51681f..130428f57c 100644 --- a/github/data_source_github_organization.go +++ b/github/data_source_github_organization.go @@ -63,7 +63,11 @@ func dataSourceGithubOrganizationRead(d *schema.ResourceData, meta interface{}) return err } - plan := organization.GetPlan() + var planName string + + if plan := organization.GetPlan(); plan != nil { + planName = plan.GetName() + } opts := &github.RepositoryListByOrgOptions{ ListOptions: github.ListOptions{PerPage: 10, Page: 1}, @@ -117,7 +121,7 @@ func dataSourceGithubOrganizationRead(d *schema.ResourceData, meta interface{}) d.Set("login", organization.GetLogin()) d.Set("name", organization.GetName()) d.Set("description", organization.GetDescription()) - d.Set("plan", plan.Name) + d.Set("plan", planName) d.Set("repositories", repoList) d.Set("members", memberList)