Skip to content

Commit edb3613

Browse files
committed
ehh
1 parent 0f10127 commit edb3613

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

internal/fleet/agent_policy/models.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/hashicorp/go-version"
1212
"github.com/hashicorp/terraform-plugin-framework/diag"
13-
"github.com/hashicorp/terraform-plugin-framework/path"
1413
"github.com/hashicorp/terraform-plugin-framework/types"
1514
)
1615

@@ -22,7 +21,7 @@ type globalDataTagModel struct {
2221
func newGlobalDataTagModel(data struct {
2322
Name string "json:\"name\""
2423
Value kbapi.AgentPolicy_GlobalDataTags_Value "json:\"value\""
25-
}, meta utils.ListMeta) globalDataTagModel {
24+
}) globalDataTagModel {
2625
val, err := data.Value.AsAgentPolicyGlobalDataTagsValue0()
2726
if err != nil {
2827
panic(err)
@@ -94,11 +93,18 @@ func (model *agentPolicyModel) populateFromAPI(ctx context.Context, data *kbapi.
9493
model.Namespace = types.StringValue(data.Namespace)
9594
if serverVersion.GreaterThanOrEqual(MinVersionGlobalDataTags) && hasKey(data, "GlobalDataTags") {
9695
var diag diag.Diagnostics
97-
gdt := utils.SliceToListType(ctx, *data.GlobalDataTags, getGlobalDataTagsType(), path.Root("global_data_tags"), &diag, newGlobalDataTagModel)
96+
gdt := []globalDataTagModel{}
97+
for _, val := range *data.GlobalDataTags {
98+
gdt = append(gdt, newGlobalDataTagModel(val))
99+
}
100+
gdtList, diags := types.ListValueFrom(ctx, getGlobalDataTagsType(), gdt)
101+
if diags.HasError() {
102+
return
103+
}
104+
model.GlobalDataTags = gdtList
98105
if diag.HasError() {
99106
return
100107
}
101-
model.GlobalDataTags = gdt
102108
}
103109
}
104110

0 commit comments

Comments
 (0)