0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-05 05:24:01 +00:00

fix(vm): default disk cache is not set to none if not specified for an existing disk (#478)

Also fixes missing `ForceNew` for `file` resources.
This commit is contained in:
Pavel Boldyrev 2023-08-10 15:27:22 -04:00 committed by GitHub
parent 185e98fe80
commit 8d0b3ed25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -33,7 +33,6 @@ example: example-build example-init example-apply example-destroy
example-apply: example-apply:
export TF_CLI_CONFIG_FILE="$(shell pwd -P)/example.tfrc" \ export TF_CLI_CONFIG_FILE="$(shell pwd -P)/example.tfrc" \
&& export TF_REATTACH_PROVIDERS='{"registry.terraform.io/bpg/proxmox":{"Protocol":"grpc","ProtocolVersion":6,"Pid":82711,"Test":true,"Addr":{"Network":"unix","String":"/var/folders/xx/4plpx_3133lbctp7b7v1yfch0000gn/T/plugin3121225613"}}}' \
&& export TF_DISABLE_CHECKPOINT="true" \ && export TF_DISABLE_CHECKPOINT="true" \
&& export TF_PLUGIN_CACHE_DIR="$(TERRAFORM_PLUGIN_CACHE_DIRECTORY)" \ && export TF_PLUGIN_CACHE_DIR="$(TERRAFORM_PLUGIN_CACHE_DIRECTORY)" \
&& cd ./example \ && cd ./example \

View File

@ -196,6 +196,7 @@ func File() *schema.Resource {
Type: schema.TypeInt, Type: schema.TypeInt,
Description: "Timeout for uploading ISO/VSTMPL files in seconds", Description: "Timeout for uploading ISO/VSTMPL files in seconds",
Optional: true, Optional: true,
ForceNew: true,
Default: dvResourceVirtualEnvironmentFileTimeoutUpload, Default: dvResourceVirtualEnvironmentFileTimeoutUpload,
}, },
}, },

View File

@ -3706,13 +3706,13 @@ func vmReadCustom(
if dd.Discard != nil { if dd.Discard != nil {
disk[mkResourceVirtualEnvironmentVMDiskDiscard] = *dd.Discard disk[mkResourceVirtualEnvironmentVMDiskDiscard] = *dd.Discard
} else { } else {
disk[mkResourceVirtualEnvironmentVMDiskDiscard] = "" disk[mkResourceVirtualEnvironmentVMDiskDiscard] = dvResourceVirtualEnvironmentVMDiskDiscard
} }
if dd.Cache != nil { if dd.Cache != nil {
disk[mkResourceVirtualEnvironmentVMDiskCache] = *dd.Cache disk[mkResourceVirtualEnvironmentVMDiskCache] = *dd.Cache
} else { } else {
disk[mkResourceVirtualEnvironmentVMDiskCache] = "" disk[mkResourceVirtualEnvironmentVMDiskCache] = dvResourceVirtualEnvironmentVMDiskCache
} }
diskMap[di] = disk diskMap[di] = disk
@ -5007,6 +5007,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
tmp.BurstableWriteSpeedMbps = value.BurstableWriteSpeedMbps tmp.BurstableWriteSpeedMbps = value.BurstableWriteSpeedMbps
tmp.MaxReadSpeedMbps = value.MaxReadSpeedMbps tmp.MaxReadSpeedMbps = value.MaxReadSpeedMbps
tmp.MaxWriteSpeedMbps = value.MaxWriteSpeedMbps tmp.MaxWriteSpeedMbps = value.MaxWriteSpeedMbps
tmp.Cache = value.Cache
switch prefix { switch prefix {
case "virtio": case "virtio":