Skip to content

Commit

Permalink
Merge pull request #1061 from Tinyblargon/description
Browse files Browse the repository at this point in the history
fix: can't clear description
  • Loading branch information
Tinyblargon authored Jul 26, 2024
2 parents 9afb518 + fd1f866 commit bd164e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.21.0

require (
github.com/Telmate/proxmox-api-go v0.0.0-20240623131159-931b286955ba
github.com/Telmate/proxmox-api-go v0.0.0-20240726134822-4c4580d03d9e
github.com/google/uuid v1.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/ProtonMail/go-crypto v1.1.0-alpha.2-proton h1:HKz85FwoXx86kVtTvFke7rgHvq/HoloSUvW5semjFWs=
github.com/ProtonMail/go-crypto v1.1.0-alpha.2-proton/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
github.com/Telmate/proxmox-api-go v0.0.0-20240623131159-931b286955ba h1:3LHJ7Y6/8KC6fUo5XKi/+WvNVuA7kY9Xz+pp7bUznlo=
github.com/Telmate/proxmox-api-go v0.0.0-20240623131159-931b286955ba/go.mod h1:O6yNUi0hG9GQLMBgpikSvbnuek1OMweFtbac1sfGuUs=
github.com/Telmate/proxmox-api-go v0.0.0-20240726134822-4c4580d03d9e h1:e2StaFGv+J2yhCP29DBQmchLQHNqbCnLomZGx66p6/Q=
github.com/Telmate/proxmox-api-go v0.0.0-20240726134822-4c4580d03d9e/go.mod h1:O6yNUi0hG9GQLMBgpikSvbnuek1OMweFtbac1sfGuUs=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
Expand Down
13 changes: 10 additions & 3 deletions proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ func resourceVmQemuCreate(ctx context.Context, d *schema.ResourceData, meta inte

config := pxapi.ConfigQemu{
Name: vmName,
Description: d.Get("desc").(string),
Description: pointer(d.Get("desc").(string)),
Pool: pointer(pxapi.PoolName(d.Get("pool").(string))),
Bios: d.Get("bios").(string),
Onboot: pointer(d.Get("onboot").(bool)),
Expand Down Expand Up @@ -1138,7 +1138,7 @@ func resourceVmQemuUpdate(ctx context.Context, d *schema.ResourceData, meta inte

config := pxapi.ConfigQemu{
Name: d.Get("name").(string),
Description: d.Get("desc").(string),
Description: pointer(d.Get("desc").(string)),
Pool: pointer(pxapi.PoolName(d.Get("pool").(string))),
Bios: d.Get("bios").(string),
Onboot: pointer(d.Get("onboot").(bool)),
Expand Down Expand Up @@ -1426,7 +1426,7 @@ func resourceVmQemuRead(ctx context.Context, d *schema.ResourceData, meta interf

d.SetId(resourceId(vmr.Node(), "qemu", vmr.VmId()))
d.Set("name", config.Name)
d.Set("desc", config.Description)
d.Set("desc", mapToTerraform_Description(config.Description))
d.Set("bios", config.Bios)
d.Set("onboot", config.Onboot)
d.Set("startup", config.Startup)
Expand Down Expand Up @@ -1987,6 +1987,13 @@ func mapToTerraform_CloudInitNetworkConfig(config pxapi.CloudInitNetworkConfig)
return ""
}

func mapToTerraform_Description(description *string) string {
if description != nil {
return *description
}
return ""
}

func mapFormStruct_IsoFile(config *pxapi.IsoFile) string {
if config == nil {
return ""
Expand Down

0 comments on commit bd164e1

Please sign in to comment.