Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow setting smbios for each VM (optional values) #451

Closed
si458 opened this issue Aug 2, 2023 · 9 comments · Fixed by #454
Closed

allow setting smbios for each VM (optional values) #451

si458 opened this issue Aug 2, 2023 · 9 comments · Fixed by #454
Labels
✨ enhancement New feature or request

Comments

@si458
Copy link

si458 commented Aug 2, 2023

Is your feature request related to a problem? Please describe.
when i clone a VM i created using the talos nocloud option, i need to set the smbios to a URL with confirmation already set
https://www.talos.dev/v1.4/talos-guides/install/cloud-platforms/nocloud/#smbios-proxmox

Describe the solution you'd like
to allow myself to set the smbios to certain values
this is already possible via the API GET and POST, values are base64 encoded
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/config

Describe alternatives you've considered
create vm and set the smbios manually in the web panel of proxmox

Additional context
Add any other context or screenshots about the feature request here.

{
  smbios: {
    base64: 1|0,
    family: "family",
    manufacturer: "manufacturer",
    product: "product",
    serial: "serial",
    sku: "sku",
    uuid: "uuid",
    version: "version"
  }
}
@si458 si458 added the ✨ enhancement New feature or request label Aug 2, 2023
@si458 si458 changed the title allow setting smbios for each VM allow setting smbios for each VM (optional values) Aug 2, 2023
@bpg
Copy link
Owner

bpg commented Aug 2, 2023

Duplicates #353, but I'll keep them both for tracking.

@si458
Copy link
Author

si458 commented Aug 2, 2023

Duplicates #353, but I'll keep them both for tracking.

Not sure how I missed that thanks!

@bpg
Copy link
Owner

bpg commented Aug 4, 2023

@si458 Thanks for contributing bugs / enhancements! Really appreciated!
Please don't be shy to review my PRs as well :)

Typos are sneaky, so a second pair of 👀 is really welcome, as well as any other suggestions regarding terraform API / namings / docs, etc, etc...

@si458
Copy link
Author

si458 commented Aug 4, 2023

Thanks @bpg
And this might sound daft but I have no clue with Golang 🤣 I'm a nodejs guy
And pointers on how to test ur test branch before u merge?

@si458
Copy link
Author

si458 commented Aug 4, 2023

eventually managed to get it working using ubuntu!

built it locally with go then followed part of https://www.infracloud.io/blogs/developing-terraform-custom-provider/ for help where to place file etc!

seems to work a treat with creating with ISO, i will try with clone a VM with an nocloud image

HINT FOR OTHERS

FILE LOCATION:
~/.terraform.d/plugins/localhost/bpg/proxmox/0.27.0/linux_amd64/terraform-provider-proxmox_v0.27.0

MAIN.TF:
terraform {
  required_providers {
    proxmox = {
      source = "localhost/bpg/proxmox"
      version = "~> 0.27.0"
    }
  }
}

.terraformrc:
plugin_cache_dir   = "$HOME/.terraform.d/plugin-cache"
disable_checkpoint = true

@si458
Copy link
Author

si458 commented Aug 4, 2023

OH NO it doesnt work with cloning?

2023-08-04T14:34:39.019+0100 [DEBUG] provider.terraform-provider-proxmox_v0.27.0: 2023/08/04 14:34:39 [ERROR] setting state: smbios.0: '' expected a map, got 'slice'
2023-08-04T14:34:39.019+0100 [ERROR] provider.terraform-provider-proxmox_v0.27.0: Response contains error diagnostic: diagnostic_summary="smbios.0: '' expected a map, got 'slice'" tf_provider_addr=registry.terraform.io/bpg/proxmox tf_req_id=8cc49bed-b72e-9803-c11a-97c7bd556ae0 @caller=/root/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_detail= diagnostic_severity=ERROR tf_proto_version=6.3 tf_resource_type=proxmox_virtual_environment_vm tf_rpc=ApplyResourceChange @module=sdk.proto timestamp=2023-08-04T14:34:39.019+0100
2023-08-04T14:34:39.030+0100 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2023-08-04T14:34:39.030+0100 [ERROR] vertex "proxmox_virtual_environment_vm.k8s-1" error: smbios.0: '' expected a map, got 'slice'
╷
│ Error: smbios.0: '' expected a map, got 'slice'
│
│   with proxmox_virtual_environment_vm.k8s-1,
│   on main.tf line 15, in resource "proxmox_virtual_environment_vm" "k8s-1":
│   15: resource "proxmox_virtual_environment_vm" "k8s-1" {
│
╵
2023-08-04T14:34:39.034+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-08-04T14:34:39.035+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/localhost/bpg/proxmox/0.27.0/linux_amd64/terraform-provider-proxmox_v0.27.0 pid=1339
2023-08-04T14:34:39.035+0100 [DEBUG] provider: plugin exited

CONFIG:

terraform {
  required_providers {
    proxmox = {
      source = "localhost/bpg/proxmox"
      version = "~> 0.27.0"
    }
  }
}
provider "proxmox" {
  endpoint = "https://192.168.168.121:8006/"
  username = "root@pam"
  password = "g4tt1123"
  insecure = true
}
resource "proxmox_virtual_environment_vm" "k8s-1" {
  disk {
    datastore_id = "local-zfs"
    discard      = "on"
    file_format  = "raw"
    interface    = "scsi1"
    iothread     = true
    cache        = "writeback"
    size         = 128
  }
  name = "k8s-1"
  node_name = "pve1"
  smbios {
    serial       = "serial"
  }
  clone {
    datastore_id = "local-zfs"
    node_name = "pve1"
    vm_id = "9001"
  }
}

@bpg
Copy link
Owner

bpg commented Aug 4, 2023

Oh... thanks! I didn't test this case, which seems quite obvious now 😅

@bpg
Copy link
Owner

bpg commented Aug 5, 2023

OH NO it doesnt work with cloning?

@si458 this should be fixed now.

@bpg bpg closed this as completed in #454 Aug 6, 2023
@si458
Copy link
Author

si458 commented Aug 6, 2023

thanks @bpg! just waiting a new release now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants