Skip to content

Commit

Permalink
fix: removing plan modifiers from terraform fields with UseStateForUn…
Browse files Browse the repository at this point in the history
…kown that are dynamic (#1275)

* fix: removing plan modifiers from terraform fields with UseStateForUnkown that are dynamic

* chore:  fix lint
  • Loading branch information
publi0 authored Dec 2, 2024
1 parent 44ba8c0 commit 4f501a0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
5 changes: 1 addition & 4 deletions mgc/terraform-provider-mgc/mgc/resources/mgc_bs_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ func (r *bsSnapshots) Schema(_ context.Context, _ resource.SchemaRequest, resp *
},
"final_name": schema.StringAttribute{
Description: "The final name of the volume snapshot after applying any naming conventions or modifications.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Computed: true,
Computed: true,
},
"updated_at": schema.StringAttribute{
Description: "The timestamp when the block storage was last updated.",
Expand Down
6 changes: 1 addition & 5 deletions mgc/terraform-provider-mgc/mgc/resources/mgc_bs_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,13 @@ func (r *bsVolumes) Schema(_ context.Context, _ resource.SchemaRequest, resp *re
"name": schema.StringAttribute{
Description: "The name of the block storage.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
stringplanmodifier.RequiresReplace(),
},
Required: true,
},
"final_name": schema.StringAttribute{
Description: "The final name of the block storage after applying any naming conventions or modifications.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Computed: true,
Computed: true,
},
"snapshot_id": schema.StringAttribute{
Description: "The unique identifier of the snapshot used to create the block storage.",
Expand Down
10 changes: 2 additions & 8 deletions mgc/terraform-provider-mgc/mgc/resources/mgc_vm_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,7 @@ func (r *vmInstances) Schema(_ context.Context, _ resource.SchemaRequest, resp *
},
"final_name": schema.StringAttribute{
Description: "The final name of the virtual machine instance after applying any naming conventions or modifications.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Computed: true,
Computed: true,
},
"updated_at": schema.StringAttribute{
Description: "The timestamp when the virtual machine instance was last updated.",
Expand Down Expand Up @@ -221,10 +218,7 @@ func (r *vmInstances) Schema(_ context.Context, _ resource.SchemaRequest, resp *
},
"name": schema.StringAttribute{
Description: "The name of the machine type.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Required: true,
Required: true,
},
"disk": schema.NumberAttribute{
Description: "The disk size of the machine type.",
Expand Down
5 changes: 2 additions & 3 deletions mgc/terraform-provider-mgc/mgc/resources/mgc_vm_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ func (r *vmSnapshots) Schema(_ context.Context, _ resource.SchemaRequest, resp *
Required: true,
},
"updated_at": schema.StringAttribute{
Description: "The timestamp when the snapshot was last updated.",
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
Description: "The timestamp when the snapshot was last updated.",
Computed: true,
},
"created_at": schema.StringAttribute{
Description: "The timestamp when the snapshot was created.",
Expand Down

0 comments on commit 4f501a0

Please sign in to comment.