Skip to content

Commit bba957f

Browse files
committed
Use sets for tags/tiering.object_tags and add plan modifiers to use state for unknown
1 parent 1088256 commit bba957f

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

internal/provider/storage/storage_volume_data_source.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func (d *StorageVolumeDataSource) Schema(ctx context.Context, req datasource.Sch
267267
MarkdownDescription: "Determines how many days must pass before inactive data in a volume using the Auto or Snapshot-Only policy is considered cold and eligible for tiering",
268268
Computed: true,
269269
},
270-
"object_tags": schema.ListAttribute{
270+
"object_tags": schema.SetAttribute{
271271
ElementType: types.StringType,
272272
MarkdownDescription: "Object tags are applied to objects in tiered storage",
273273
Computed: true,
@@ -356,7 +356,7 @@ func (d *StorageVolumeDataSource) Schema(ctx context.Context, req datasource.Sch
356356
MarkdownDescription: "Whether or not snapshot copy locking is enabled on the volume.",
357357
Computed: true,
358358
},
359-
"tags": schema.ListAttribute{
359+
"tags": schema.SetAttribute{
360360
ElementType: types.StringType,
361361
MarkdownDescription: "List of tags associated with the volume",
362362
Computed: true,

internal/provider/storage/storage_volume_resource.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
2121
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
2222
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
23+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier"
2324
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
2425
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
2526
"github.com/hashicorp/terraform-plugin-framework/types"
@@ -413,11 +414,14 @@ func (r *StorageVolumeResource) Schema(ctx context.Context, req resource.SchemaR
413414
int64planmodifier.UseStateForUnknown(),
414415
},
415416
},
416-
"object_tags": schema.ListAttribute{
417+
"object_tags": schema.SetAttribute{
417418
ElementType: types.StringType,
418419
MarkdownDescription: "Object tags are applied to objects in tiered storage",
419420
Optional: true,
420421
Computed: true,
422+
PlanModifiers: []planmodifier.Set{
423+
setplanmodifier.UseStateForUnknown(),
424+
},
421425
},
422426
},
423427
},
@@ -576,11 +580,14 @@ func (r *StorageVolumeResource) Schema(ctx context.Context, req resource.SchemaR
576580
},
577581
},
578582
},
579-
"tags": schema.ListAttribute{
583+
"tags": schema.SetAttribute{
580584
ElementType: types.StringType,
581-
MarkdownDescription: "List of tags associated with the volume",
585+
MarkdownDescription: "Set of tags associated with the volume",
582586
Optional: true,
583587
Computed: true,
588+
PlanModifiers: []planmodifier.Set{
589+
setplanmodifier.UseStateForUnknown(),
590+
},
584591
},
585592
"id": schema.StringAttribute{
586593
Computed: true,

internal/provider/storage/storage_volumes_data_source.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func (d *StorageVolumesDataSource) Schema(ctx context.Context, req datasource.Sc
221221
MarkdownDescription: "Determines how many days must pass before inactive data in a volume using the Auto or Snapshot-Only policy is considered cold and eligible for tiering",
222222
Computed: true,
223223
},
224-
"object_tags": schema.ListAttribute{
224+
"object_tags": schema.SetAttribute{
225225
ElementType: types.StringType,
226226
MarkdownDescription: "Object tags are applied to objects in tiered storage",
227227
Computed: true,
@@ -306,9 +306,9 @@ func (d *StorageVolumesDataSource) Schema(ctx context.Context, req datasource.Sc
306306
Computed: true,
307307
MarkdownDescription: "Volume identifier",
308308
},
309-
"tags": schema.ListAttribute{
309+
"tags": schema.SetAttribute{
310310
ElementType: types.StringType,
311-
MarkdownDescription: "List of tags associated with the volume",
311+
MarkdownDescription: "Set of tags associated with the volume",
312312
Computed: true,
313313
},
314314
},

0 commit comments

Comments
 (0)