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

Invalid value for custom field #181

Open
openmsk opened this issue Mar 4, 2023 · 2 comments
Open

Invalid value for custom field #181

openmsk opened this issue Mar 4, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@openmsk
Copy link

openmsk commented Mar 4, 2023

Summary

Version

Netbox version

3.3
3.4 

Terraform version

Terraform v0.13.7

Provider version

6.1.0

Issue details

Affected Data(s) / Resource(s)

  • data dcim_site
  • resource netbox_virtualization_vm
  • custom_field

Terraform Configuration Files

resource "netbox_virtualization_vm" "vm" {
  name        = "${var.vm_name}.${var.vm_domain}"
  comments    = var.vm_desc
  disk        = var.vm_disk_size
  memory      = var.vm_mem
  vcpus       = var.vm_cpu_cores
  platform_id = local.list_platform_id[var.vm_platform_id]
  cluster_id  = data.netbox_virtualization_cluster.cluster.id

  custom_field {
    name  = "vm_server_role"
    type  = "text"
    value = var.vm_server_role
  }
}

Terraform Output

Error: response status code does not match any response statuses defined for this endpoint in the swagger spec (status 400): {}

  on .terraform/modules/test3_terraform.netbox/netbox.tf line 2, in resource "netbox_virtualization_vm" "vm":
   2: resource "netbox_virtualization_vm" "vm" {

Behaviors

Actual Behavior

Error: [POST /virtualization/virtual-machines/][400] virtualization_virtual-machines_create default  map[__all__:[Invalid value for custom field 'vm_server_role': Invalid choice (ansibles). Available choices are: ansible, sftp, sharepoint, smtp, som-cache, sphinx-travel, srv-common]]

  on .terraform/modules/test3_terraform.netbox/netbox.tf line 52, in resource "netbox_virtual_machine" "vm":
  52: resource "netbox_virtual_machine" "vm" {

Expected Behavior

If a custom field contains a choice of values, and a new value is specified in hcl, then the provider needs to report the response from the netbox.

Steps to Reproduce

  1. terraform apply
@openmsk openmsk added the bug Something isn't working label Mar 4, 2023
@openmsk openmsk changed the title [Main title for your issue here] Invalid value for custom field Mar 4, 2023
@smutel
Copy link
Owner

smutel commented Mar 12, 2023

Hello. What you want in this issue is to improve the error message or to add the missing value throught terraform ?

@openmsk
Copy link
Author

openmsk commented Apr 18, 2023

hello, i would like terraform to report an error like the e-breuninger provider

Error: [POST /virtualization/virtual-machines/][400] 
virtualization_virtual-machines_create default  map[__all__:
[Invalid value for custom field 'vm_server_role': Invalid choice (ansibles). 
Available choices are: 1c, analytics, ansible, apache-airflow, appnginx, artifactory, zookeeper]]

  on .terraform/modules/test3_terraform.netbox/netbox.tf line 52, in resource "netbox_virtual_machine" "vm":
  52: resource "netbox_virtual_machine" "vm" {

@smutel smutel added enhancement New feature or request and removed bug Something isn't working labels Aug 11, 2023
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

No branches or pull requests

2 participants