diff --git a/proxmoxtf/resource/vm/validators.go b/proxmoxtf/resource/vm/validators.go index 9bf6940c..f1a5905b 100644 --- a/proxmoxtf/resource/vm/validators.go +++ b/proxmoxtf/resource/vm/validators.go @@ -55,6 +55,7 @@ func BIOSValidator() schema.SchemaValidateDiagFunc { // CPUArchitectureValidator returns a schema validation function for a CPU architecture. func CPUArchitectureValidator() schema.SchemaValidateDiagFunc { return validation.ToDiagFunc(validation.StringInSlice([]string{ + "", "aarch64", "x86_64", }, false)) diff --git a/proxmoxtf/resource/vm/vm.go b/proxmoxtf/resource/vm/vm.go index 9cf8b8ab..862eaa1b 100644 --- a/proxmoxtf/resource/vm/vm.go +++ b/proxmoxtf/resource/vm/vm.go @@ -58,7 +58,7 @@ const ( dvCloneNodeName = "" dvCloneFull = true dvCloneRetries = 1 - dvCPUArchitecture = "x86_64" + dvCPUArchitecture = "" dvCPUCores = 1 dvCPUHotplugged = 0 dvCPULimit = 0 @@ -1890,8 +1890,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d } // Only the root account is allowed to change the CPU architecture, which makes this check necessary. - if client.API().IsRootTicket() || - cpuArchitecture != dvCPUArchitecture { + if client.API().IsRootTicket() && cpuArchitecture != "" { updateBody.CPUArchitecture = &cpuArchitecture } @@ -2574,8 +2573,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{}) } // Only the root account is allowed to change the CPU architecture, which makes this check necessary. - if client.API().IsRootTicket() || - cpuArchitecture != dvCPUArchitecture { + if client.API().IsRootTicket() && cpuArchitecture != "" { createBody.CPUArchitecture = &cpuArchitecture } @@ -4845,8 +4843,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D cpuAffinity := cpuBlock[mkCPUAffinity].(string) // Only the root account is allowed to change the CPU architecture, which makes this check necessary. - if client.API().IsRootTicket() || - cpuArchitecture != dvCPUArchitecture { + if client.API().IsRootTicket() && cpuArchitecture != "" { updateBody.CPUArchitecture = &cpuArchitecture }