@@ -455,7 +455,6 @@ func resourceEnterpriseGroupRead(ctx context.Context, data *schema.ResourceData,
455455 }
456456
457457 if group == nil {
458- // Group not found, remove from state
459458 tflog .Warn (
460459 ctx ,
461460 "Group not found, removing from state" ,
@@ -465,15 +464,16 @@ func resourceEnterpriseGroupRead(ctx context.Context, data *schema.ResourceData,
465464 },
466465 )
467466 data .SetId ("" )
468- } else {
469- groupWithRoleBindings , err := convertListGroupsResponseGroup (ctx , client , enterpriseIDStr , * group )
470- if err != nil {
471- return diag .FromErr (fmt .Errorf ("fetching role bindings for groups: %w" , err ))
472- }
467+ return nil
468+ }
473469
474- if err = setEnterpriseGroupsData (ctx , data , groupWithRoleBindings ); err != nil {
475- return diag .FromErr (fmt .Errorf ("failed to set read groups data: %w" , err ))
476- }
470+ groupWithRoleBindings , err := convertListGroupsResponseGroup (ctx , client , enterpriseIDStr , * group )
471+ if err != nil {
472+ return diag .FromErr (fmt .Errorf ("fetching role bindings for groups: %w" , err ))
473+ }
474+
475+ if err = setEnterpriseGroupsData (ctx , data , groupWithRoleBindings ); err != nil {
476+ return diag .FromErr (fmt .Errorf ("failed to set read groups data: %w" , err ))
477477 }
478478
479479 tflog .Debug (ctx , "Finished reading enterprise group" , map [string ]any {"group_id" : data .Id ()})
0 commit comments