From b6e0602a90e459e5e1df8a1ced47b425aecc7359 Mon Sep 17 00:00:00 2001 From: "Brandon Waite (Bison Trails)" <52925881+bison-brandon@users.noreply.github.com> Date: Fri, 11 Mar 2022 10:17:14 -0800 Subject: [PATCH] fix: use the appropriate ID when trying to import `github_team_members` objects (#1074) When importing a `github_team_member`, the import command passes in team ID as the "Id", not the "team_id" captured in the state for existing resources, and this empty string is causing the import step to fail when parsing as a number. Should fix #608, as I hit the same error. --- github/resource_github_team_members.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github/resource_github_team_members.go b/github/resource_github_team_members.go index 4f352158a8..7726afcac0 100644 --- a/github/resource_github_team_members.go +++ b/github/resource_github_team_members.go @@ -185,6 +185,10 @@ func resourceGithubTeamMembersRead(d *schema.ResourceData, meta interface{}) err client := meta.(*Owner).v3client orgId := meta.(*Owner).id teamIdString := d.Get("team_id").(string) + if teamIdString == "" && !d.IsNewResource() { + log.Printf("[DEBUG] Importing team with id %q", d.Id()) + teamIdString = d.Id() + } teamId, err := strconv.ParseInt(teamIdString, 10, 64) if err != nil {