Skip to content

Commit 1cf7a62

Browse files
committed
passing tests
1 parent dc0360c commit 1cf7a62

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

internal/fleet/agent_policy/models.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/elastic/terraform-provider-elasticstack/internal/utils"
99

1010
"github.com/hashicorp/go-version"
11+
"github.com/hashicorp/terraform-plugin-framework/attr"
1112
"github.com/hashicorp/terraform-plugin-framework/diag"
1213
"github.com/hashicorp/terraform-plugin-framework/path"
1314
"github.com/hashicorp/terraform-plugin-framework/types"
@@ -84,11 +85,12 @@ func (model *agentPolicyModel) populateFromAPI(ctx context.Context, data *kbapi.
8485
}
8586
}
8687
}
87-
gdt := utils.MapValueFrom(ctx, map0, getGlobalDataTagsAttrType(), path.Root("global_data_tags"), &diags)
88+
89+
model.GlobalDataTags = utils.MapValueFrom(ctx, map0, getGlobalDataTagsAttrTypes().(attr.TypeWithElementType).ElementType(), path.Root("global_data_tags"), &diags)
8890
if diags.HasError() {
8991
return diags
9092
}
91-
model.GlobalDataTags = gdt
93+
9294
}
9395

9496
return nil

internal/fleet/agent_policy/schema.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,12 @@ func getSchema() schema.Schema {
9595
"string_value": schema.StringAttribute{
9696
Description: "String value for the field. If this is set, number_value must not be defined.",
9797
Optional: true,
98-
// Validators: []validator.String{
99-
// stringvalidator.ExactlyOneOf(path.MatchRelative()),
100-
// },
10198
},
10299
"number_value": schema.Float32Attribute{
103100
Description: "Number value for the field. If this is set, string_value must not be defined.",
104101
Optional: true,
105-
// Validators: []validator.Float32{
106-
// float32validator.ExactlyOneOf(path.MatchRelative()),
107-
// },
108102
},
109103
},
110-
// Validators: []validator.Object{
111-
// objectvalidator.ExactlyOneOf(path.MatchRelative().AtAnyMapKey())
112-
// },
113104
},
114105
Optional: true,
115106
PlanModifiers: []planmodifier.Map{
@@ -118,7 +109,6 @@ func getSchema() schema.Schema {
118109
},
119110
}}
120111
}
121-
122-
func getGlobalDataTagsAttrType() attr.Type {
112+
func getGlobalDataTagsAttrTypes() attr.Type {
123113
return getSchema().Attributes["global_data_tags"].GetType()
124114
}

0 commit comments

Comments
 (0)