diff --git a/docs/resources/vm.md b/docs/resources/vm.md index ec6cc6db..6d55dcbf 100644 --- a/docs/resources/vm.md +++ b/docs/resources/vm.md @@ -186,7 +186,7 @@ Optional: - `adapter_type` (String) The type of vNic to create on this interface. Value must be one of: `VMXNET3` (A VMXNET3 adapter it's an paravirtualized NIC designed for performance. VMXNET 3 offers all the features available in VMXNET 2 and adds several new features.), `E1000E` (A E1000E adapter it's an Emulated version of the Intel 82574 Gigabit Ethernet NIC. E1000E is the default adapter for Windows 8 and Windows Server 2012.), `VMXNET3VRDMA` (VMXNET3VRDMA adapter it's a paravirtualized NIC that supports remote direct memory access (RDMA) between virtual machines through the OFED verbs API.), `SRIOVETHERNETCARD` (SRIOVETHERNETCARD adapter it's a representation of a virtual function (VF) on a physical NIC with SR-IOV support.). Value defaults to `VMXNET3`. - `connected` (Boolean) Whether the network interface is connected or not. Value defaults to `true`. - `ip` (String) The IP address to assign to this VM on this network. Must be a valid IP with net.ParseIP. If <.ip_allocation_mode attribute is set and the value is one of `"MANUAL"`, `"POOL"`, this attribute is REQUIRED. If <.ip_allocation_mode attribute is set and the value is one of `"DHCP"`, `"NONE"`, this attribute is NULL. -- `ip_allocation_mode` (String) The IP allocation mode for this network. Value must be one of : `DHCP`, `POOL`, `MANUAL`, `NONE`. Value defaults to `DHCP`. +- `ip_allocation_mode` (String) The IP allocation mode for this network. Value must be one of: `DHCP` (IP address is obtained from a DHCP service.), `POOL` (Static IP address is allocated automatically from defined static pool in network.), `MANUAL` (SIP address is assigned manually in the ip field. Must be valid IP address from static pool.), `NONE` (No IP address will be set because VM will have a NIC without network.). Value defaults to `DHCP`. - `is_primary` (Boolean) Whether this network is the primary network for the VM. Value defaults to `false`. - `mac` (String) The MAC address to assign to this VM on this network. Autogenerated if not specified. Must be a valid mac address. - `name` (String) The name of the network to attach to the VM. If <.type attribute is set and the value is one of `"vapp"`, `"org"`, this attribute is REQUIRED. If <.type attribute is set and the value is one of `"none"`, this attribute is NULL. @@ -224,7 +224,7 @@ Optional: - `join_domain_password` (String, Sensitive) The domain password to join. - `join_domain_user` (String) The domain user to join. - `join_org_domain` (Boolean) Use organization's domain for joining. -- `must_change_password_on_first_login` (Boolean) . +- `must_change_password_on_first_login` (Boolean) Whether the password must be changed on first login. - `number_of_auto_logons` (Number) The number of times the VM should auto-login. Value must be at least 0. diff --git a/internal/provider/vm/vm_disk_schema.go b/internal/provider/vm/vm_disk_schema.go index 925cb7cc..5619156e 100644 --- a/internal/provider/vm/vm_disk_schema.go +++ b/internal/provider/vm/vm_disk_schema.go @@ -162,7 +162,7 @@ func DiskSuperSchema() superschema.Schema { PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - Validators: []validator.String{ // TODO: Miss the validation of the bus type if disk is detachable or not. + Validators: []validator.String{ stringvalidator.OneOf(diskparams.ListOfBusTypes...), }, }, diff --git a/internal/provider/vm/vm_schema.go b/internal/provider/vm/vm_schema.go index 33307c11..e905489c 100644 --- a/internal/provider/vm/vm_schema.go +++ b/internal/provider/vm/vm_schema.go @@ -354,7 +354,24 @@ func vmSuperSchema(_ context.Context) superschema.Schema { Optional: true, Default: stringdefault.StaticString("DHCP"), Validators: []validator.String{ - stringvalidator.OneOf("DHCP", "POOL", "MANUAL", "NONE"), + fstringvalidator.OneOfWithDescription( + fstringvalidator.OneOfWithDescriptionValues{ + Value: "DHCP", + Description: "IP address is obtained from a DHCP service.", + }, + fstringvalidator.OneOfWithDescriptionValues{ + Value: "POOL", + Description: "Static IP address is allocated automatically from defined static pool in network.", + }, + fstringvalidator.OneOfWithDescriptionValues{ + Value: "MANUAL", + Description: "SIP address is assigned manually in the ip field. Must be valid IP address from static pool.", + }, + fstringvalidator.OneOfWithDescriptionValues{ + Value: "NONE", + Description: "No IP address will be set because VM will have a NIC without network.", + }, + ), }, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), @@ -590,7 +607,8 @@ func vmSuperSchema(_ context.Context) superschema.Schema { }, "must_change_password_on_first_login": superschema.BoolAttribute{ Resource: &schemaR.BoolAttribute{ - Optional: true, + MarkdownDescription: "Whether the password must be changed on first login.", + Optional: true, PlanModifiers: []planmodifier.Bool{ boolplanmodifier.UseStateForUnknown(), },