From c9ecc70d253a239df3b21a766fe64392c74cea1d Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Wed, 14 Sep 2022 17:32:08 -0700 Subject: [PATCH] feat: closes #862 by adding a state attribute for the state of the invite --- github/data_source_github_membership.go | 5 +++++ github/data_source_github_membership_test.go | 1 + website/docs/d/membership.html.markdown | 1 + 3 files changed, 7 insertions(+) diff --git a/github/data_source_github_membership.go b/github/data_source_github_membership.go index ace0d9f657..bd6fde0780 100644 --- a/github/data_source_github_membership.go +++ b/github/data_source_github_membership.go @@ -27,6 +27,10 @@ func dataSourceGithubMembership() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "state": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -55,5 +59,6 @@ func dataSourceGithubMembershipRead(d *schema.ResourceData, meta interface{}) er d.Set("username", membership.GetUser().GetLogin()) d.Set("role", membership.GetRole()) d.Set("etag", resp.Header.Get("ETag")) + d.Set("state", membership.GetState()) return nil } diff --git a/github/data_source_github_membership_test.go b/github/data_source_github_membership_test.go index 39a52e2f16..e3127081ad 100644 --- a/github/data_source_github_membership_test.go +++ b/github/data_source_github_membership_test.go @@ -23,6 +23,7 @@ func TestAccGithubMembershipDataSource(t *testing.T) { resource.TestCheckResourceAttr("data.github_membership.test", "username", testOwner), resource.TestCheckResourceAttrSet("data.github_membership.test", "role"), resource.TestCheckResourceAttrSet("data.github_membership.test", "etag"), + resource.TestCheckResourceAttrSet("data.github_membership.test", "state"), ) testCase := func(t *testing.T, mode string) { diff --git a/website/docs/d/membership.html.markdown b/website/docs/d/membership.html.markdown index 3401104be1..6f6e735d15 100644 --- a/website/docs/d/membership.html.markdown +++ b/website/docs/d/membership.html.markdown @@ -31,3 +31,4 @@ data "github_membership" "membership_for_some_user" { * `username` - The username. * `role` - `admin` or `member` -- the role the user has within the organization. * `etag` - An etag representing the membership object. + * `state` - `active` or `pending` -- the state of membership within the organization. `active` if the member has accepted the invite, or `pending` if the invite is still pending.