Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions github/resource_github_emu_group_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func resourceGithubEMUGroupMappingCreate(ctx context.Context, d *schema.Resource

tflog.Debug(ctx, "Successfully updated connected external group")

teamID, err := lookupTeamID(ctx, meta.(*Owner), teamSlug)
teamID, err := lookupTeamID(ctx, client, orgName, teamSlug)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -306,7 +306,11 @@ func resourceGithubEMUGroupMappingDelete(ctx context.Context, d *schema.Resource
return nil
}

func resourceGithubEMUGroupMappingImport(ctx context.Context, d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) {
func resourceGithubEMUGroupMappingImport(ctx context.Context, d *schema.ResourceData, m any) ([]*schema.ResourceData, error) {
meta := m.(*Owner)
client := meta.v3client
orgName := meta.name

importID := d.Id()
tflog.Trace(ctx, "Importing EMU group mapping with two-part ID", map[string]any{
"import_id": importID,
Expand All @@ -329,7 +333,7 @@ func resourceGithubEMUGroupMappingImport(ctx context.Context, d *schema.Resource
"team_slug": teamSlug,
})

teamID, err := lookupTeamID(ctx, meta.(*Owner), teamSlug)
teamID, err := lookupTeamID(ctx, client, orgName, teamSlug)
if err != nil {
return nil, err
}
Expand Down
5 changes: 2 additions & 3 deletions github/resource_github_emu_group_mapping_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ func resourceGithubEMUGroupMappingV0() *schema.Resource {
}

func resourceGithubEMUGroupMappingStateUpgradeV0(ctx context.Context, rawState map[string]any, meta any) (map[string]any, error) {
client := meta.(*Owner).v3client
orgName := meta.(*Owner).name
tflog.Trace(ctx, "GitHub EMU Group Mapping State before migration", map[string]any{"state": rawState, "owner": orgName})

client := meta.(*Owner).v3client

teamSlug := rawState["team_slug"].(string)
// We need to bypass the etag because we need to get the latest group
ctx = context.WithValue(ctx, ctxEtag, nil)
Expand All @@ -52,7 +51,7 @@ func resourceGithubEMUGroupMappingStateUpgradeV0(ctx context.Context, rawState m
}

group := groupsList.Groups[0]
teamID, err := lookupTeamID(ctx, meta.(*Owner), teamSlug)
teamID, err := lookupTeamID(ctx, client, orgName, teamSlug)
if err != nil {
return nil, err
}
Expand Down
Loading