Skip to content

Commit

Permalink
remove use of deprecated field
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwillis committed Apr 10, 2024
1 parent 01f66aa commit 56ec7dd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
1 change: 0 additions & 1 deletion docs/resources/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ resource "cudo_vm" "my-vm-max-price" {
boot_disk = {
image_id = "debian-11"
}
max_price_hr = 0.003
networks = [
{
network_id = "my-network"
Expand Down
1 change: 0 additions & 1 deletion examples/resources/cudo_vm/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ resource "cudo_vm" "my-vm-max-price" {
boot_disk = {
image_id = "debian-11"
}
max_price_hr = 0.003
networks = [
{
network_id = "my-network"
Expand Down
15 changes: 0 additions & 15 deletions internal/provider/vm_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
"google.golang.org/genproto/googleapis/type/decimal"
"google.golang.org/grpc/codes"
)

Expand Down Expand Up @@ -126,13 +125,6 @@ func (r *VMResource) Schema(ctx context.Context, req resource.SchemaRequest, res
Computed: true,
Validators: []validator.String{stringvalidator.RegexMatches(regexp.MustCompile("^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$"), "must be a valid resource id")},
},
"max_price_hr": schema.StringAttribute{
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
MarkdownDescription: "The maximum price per hour for the VM instance",
Optional: true,
},
"memory_gib": schema.Int64Attribute{
PlanModifiers: []planmodifier.Int64{
int64planmodifier.RequiresReplace(),
Expand Down Expand Up @@ -261,7 +253,6 @@ type VMResourceModel struct {
GPUModel types.String `tfsdk:"gpu_model"`
ID types.String `tfsdk:"id"`
MachineType types.String `tfsdk:"machine_type"`
MaxPriceHr types.String `tfsdk:"max_price_hr"`
MemoryGib types.Int64 `tfsdk:"memory_gib"`
Password types.String `tfsdk:"password"`
PriceHr types.String `tfsdk:"price_hr"`
Expand Down Expand Up @@ -368,11 +359,6 @@ func (r *VMResource) Create(ctx context.Context, req resource.CreateRequest, res
return
}

var maxPriceHr *decimal.Decimal
if !state.MaxPriceHr.IsNull() {
maxPriceHr = &decimal.Decimal{Value: state.MaxPriceHr.ValueString()}
}

metadataMap := make(map[string]string)
diag := state.Metadata.ElementsAs(ctx, &metadataMap, false)
if diag.HasError() {
Expand All @@ -386,7 +372,6 @@ func (r *VMResource) Create(ctx context.Context, req resource.CreateRequest, res
DataCenterId: state.DataCenterID.ValueString(),
Gpus: int32(state.GPUs.ValueInt64()),
MachineType: state.MachineType.ValueString(),
MaxPriceHr: maxPriceHr,
MemoryGib: int32(state.MemoryGib.ValueInt64()),
Nics: nics,
BootDiskImageId: state.BootDisk.ImageID.ValueString(),
Expand Down

0 comments on commit 56ec7dd

Please sign in to comment.