smutel / terraform-provider-netbox

Terraform provider for Netbox
ISC License
58 stars 19 forks source link

Field virtual_machine does not exist in schema. #209

Closed lgrn closed 1 year ago

lgrn commented 1 year ago

Issue description

What I want to do

Filtering that looks like it should work doesn't seem to work.

This works fine:

data "netbox_json_virtualization_virtual_machines_list" "tagged_vms" {
  filter {
    name  = "tag"
    value = "foo"
  }
  limit = 0
}

The API equivalent of this would be the following, which also works:

/api/virtualization/virtual-machines/?tag=foo

Here is another API call that works:

/api/virtualization/interfaces/?virtual_machine=foo_vm

Based on this, I assumed that I would be able to do the following:

data "netbox_json_virtualization_interfaces_list" "ifs" {
  filter {
    name = "virtual_machine"
    value = "foo_vm"
  }
  limit = 0
}

But this throws an error:

Error: Field virtual_machine does not exist in schema.

I.e. this: https://github.com/smutel/terraform-provider-netbox/blob/abd326946cf1d31d6f79cde2113ca9d50b54754f/utils/generateJsonDatasources#L160

Am I doing something wrong, or is this a bug?

Other important information

Version

Netbox version

v3.5.4

Terraform version

v1.4.6

Provider version

registry.terraform.io/smutel/netbox v6.3.0

smutel commented 1 year ago

Hello,

I was able to reproduce the issue on my environment.
I did some tests but unfortunately I did'nt find the bug yet.
I will try to see this more deeply new week.

Regards,

smutel commented 1 year ago

I created a patch witch is working but I need to do some other test to be sure.