@@ -49,13 +49,18 @@ func resourceGithubEMUGroupMapping() *schema.Resource {
4949 Computed : true ,
5050 },
5151 },
52- SchemaVersion : 1 ,
52+ SchemaVersion : 2 ,
5353 StateUpgraders : []schema.StateUpgrader {
5454 {
5555 Type : resourceGithubEMUGroupMappingV0 ().CoreConfigSchema ().ImpliedType (),
5656 Upgrade : resourceGithubEMUGroupMappingStateUpgradeV0 ,
5757 Version : 0 ,
5858 },
59+ {
60+ Type : resourceGithubEMUGroupMappingV1 ().CoreConfigSchema ().ImpliedType (),
61+ Upgrade : resourceGithubEMUGroupMappingStateUpgradeV1 ,
62+ Version : 1 ,
63+ },
5964 },
6065 }
6166}
@@ -94,7 +99,7 @@ func resourceGithubEMUGroupMappingCreate(ctx context.Context, d *schema.Resource
9499 return diag .FromErr (err )
95100 }
96101
97- newResourceID , err := buildID (strconv .FormatInt (teamID , 10 ), teamSlug , strconv .FormatInt (groupID , 10 ))
102+ newResourceID , err := buildID (strconv .FormatInt (groupID , 10 ), strconv .FormatInt (teamID , 10 ))
98103 if err != nil {
99104 return diag .FromErr (err )
100105 }
@@ -226,7 +231,7 @@ func resourceGithubEMUGroupMappingUpdate(ctx context.Context, d *schema.Resource
226231 GroupID : new (groupID ),
227232 }
228233
229- if d .HasChanges ( "group_id" , "team_slug" ) {
234+ if d .HasChange ( "team_slug" ) {
230235
231236 tflog .Debug (ctx , "Updating connected external group via GitHub API" )
232237
@@ -248,18 +253,6 @@ func resourceGithubEMUGroupMappingUpdate(ctx context.Context, d *schema.Resource
248253 if err := d .Set ("group_name" , group .GetGroupName ()); err != nil {
249254 return diag .FromErr (err )
250255 }
251-
252- teamID := toInt64 (d .Get ("team_id" ))
253-
254- newResourceID , err := buildID (strconv .FormatInt (teamID , 10 ), teamSlug , strconv .FormatInt (groupID , 10 ))
255- if err != nil {
256- return diag .FromErr (err )
257- }
258-
259- tflog .Trace (ctx , "Setting resource ID" , map [string ]any {
260- "resource_id" : newResourceID ,
261- })
262- d .SetId (newResourceID )
263256 }
264257
265258 tflog .Trace (ctx , "Updated successfully" , map [string ]any {
@@ -350,7 +343,7 @@ func resourceGithubEMUGroupMappingImport(ctx context.Context, d *schema.Resource
350343 return nil , err
351344 }
352345
353- resourceID , err := buildID (strconv .FormatInt (teamID , 10 ), teamSlug , groupIDString )
346+ resourceID , err := buildID (groupIDString , strconv .FormatInt (teamID , 10 ))
354347 if err != nil {
355348 return nil , err
356349 }
0 commit comments