Skip to content

Commit 1bfcb71

Browse files
committed
Copilot PR feedback
1 parent dd7c5db commit 1bfcb71

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

internal/kibana/security_list/models.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package security_list
33
import (
44
"context"
55
"encoding/json"
6+
"time"
67

78
"github.com/elastic/terraform-provider-elasticstack/generated/kbapi"
89
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -96,7 +97,7 @@ func (m *SecurityListModel) toUpdateRequest() (*kbapi.UpdateListJSONRequestBody,
9697
}
9798

9899
if !m.Version.IsNull() && !m.Version.IsUnknown() {
99-
version := kbapi.SecurityListsAPIListVersion(m.Version.ValueInt64())
100+
version := kbapi.SecurityListsAPIListVersion(int(m.Version.ValueInt64()))
100101
req.Version = &version
101102
}
102103

@@ -115,9 +116,9 @@ func (m *SecurityListModel) fromAPI(ctx context.Context, apiList *kbapi.Security
115116
m.Immutable = types.BoolValue(apiList.Immutable)
116117
m.Version = types.Int64Value(int64(apiList.Version))
117118
m.TieBreakerID = types.StringValue(apiList.TieBreakerId)
118-
m.CreatedAt = types.StringValue(apiList.CreatedAt.String())
119+
m.CreatedAt = types.StringValue(apiList.CreatedAt.Format(time.RFC3339))
119120
m.CreatedBy = types.StringValue(apiList.CreatedBy)
120-
m.UpdatedAt = types.StringValue(apiList.UpdatedAt.String())
121+
m.UpdatedAt = types.StringValue(apiList.UpdatedAt.Format(time.RFC3339))
121122
m.UpdatedBy = types.StringValue(apiList.UpdatedBy)
122123

123124
// Set optional _version field

internal/kibana/security_list/read.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ func (r *securityListResource) Read(ctx context.Context, req resource.ReadReques
2222
}
2323

2424
spaceID := state.SpaceID.ValueString()
25-
listID := state.ListID.ValueString()
2625

2726
params := &kbapi.ReadListParams{
28-
Id: kbapi.SecurityListsAPIListId(listID),
27+
Id: kbapi.SecurityListsAPIListId(state.ID.ValueString()),
2928
}
3029

3130
readResp, diags := kibana_oapi.GetList(ctx, client, spaceID, params)

internal/kibana/security_list/schema.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func (r *securityListResource) Schema(_ context.Context, _ resource.SchemaReques
2626
Optional: true,
2727
PlanModifiers: []planmodifier.String{
2828
stringplanmodifier.RequiresReplace(),
29-
stringplanmodifier.UseStateForUnknown(),
3029
},
3130
},
3231
"space_id": schema.StringAttribute{

internal/kibana/security_list/update.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ func (r *securityListResource) Update(ctx context.Context, req resource.UpdateRe
2121
return
2222
}
2323

24-
// Preserve version_id from state for optimistic locking
25-
if state.VersionID.ValueString() != "" {
26-
plan.VersionID = state.VersionID
27-
}
28-
2924
// Convert plan to API request
3025
updateReq, diags := plan.toUpdateRequest()
3126
resp.Diagnostics.Append(diags...)

0 commit comments

Comments
 (0)