Skip to content

Commit

Permalink
Fixes for the Team Resource (#93)
Browse files Browse the repository at this point in the history
* Bugfix: ensure Team Name is read when refreshing State

* Bugfix: Ensure planned Team Name is included in Updates

* Enhancement: Require replacement if Team Name changes
  • Loading branch information
fishfacemcgee authored Dec 23, 2024
1 parent 05331f3 commit d7b3d99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/provider/team_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func (r *TeamResource) Schema(ctx context.Context, req resource.SchemaRequest, r
"name": schema.StringAttribute{
Required: true,
Description: "Team name",
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
},
"manage_state": schema.BoolAttribute{
Optional: true,
Expand Down Expand Up @@ -271,6 +274,7 @@ func (r *TeamResource) Read(ctx context.Context, req resource.ReadRequest, resp

tflog.Info(ctx, "Body Response", map[string]any{"bodyResponse": string(bodyResponse)})

state.Name = types.StringValue(team.Name)
state.ManageState = types.BoolValue(team.ManageState)
state.ManageWorkspace = types.BoolValue(team.ManageWorkspace)
state.ManageModule = types.BoolValue(team.ManageModule)
Expand Down Expand Up @@ -372,7 +376,7 @@ func (r *TeamResource) Update(ctx context.Context, req resource.UpdateRequest, r
}

plan.ID = types.StringValue(state.ID.ValueString())
plan.Name = types.StringValue(state.Name.ValueString())
plan.Name = types.StringValue(team.Name)
plan.ManageState = types.BoolValue(team.ManageState)
plan.ManageWorkspace = types.BoolValue(team.ManageWorkspace)
plan.ManageModule = types.BoolValue(team.ManageModule)
Expand Down

0 comments on commit d7b3d99

Please sign in to comment.