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

ipam_service port list is not read or created #52

Closed
amhn opened this issue Mar 14, 2021 · 1 comment · Fixed by #67
Closed

ipam_service port list is not read or created #52

amhn opened this issue Mar 14, 2021 · 1 comment · Fixed by #67
Assignees
Labels
bug Something isn't working netbox-version-not-compatible Need a new version of go-netbox/provider to manage this issue

Comments

@amhn
Copy link
Contributor

amhn commented Mar 14, 2021

Summary

ports for ipam_service are returned as list from netbox. Terraform expects a string. The field in the JSON output from netbox has been renamed from port to ports.

Version

Netbox version

3e4c35ffd9f6 (v2.10.6)

Terraform version

Terraform v0.14.8

Provider version

master (39ac08b)

Issue details

Affected Data(s) / Resource(s)

  • resource ipam_service

Terraform Configuration Files

resource "netbox_ipam_service" "service_test" {
  name = "test-service"
  port = 8081
  protocol = "tcp"
  virtualmachine_id = 1
}

Terraform Output

Terraform will perform the following actions:

  # netbox_ipam_service.service_test will be created
  + resource "netbox_ipam_service" "service_test" {
      + description       = " "
      + id                = (known after apply)
      + name              = "test-service"
      + port              = 8081
      + protocol          = "tcp"
      + virtualmachine_id = 1
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

netbox_ipam_service.service_test: Creating...

Error: [POST /ipam/services/][400] ipam_services_create default  map[ports:[This field is required.]]

  on netbox.tf line 86, in resource "netbox_ipam_service" "service_test":
  86: resource "netbox_ipam_service" "service_test" {

Behaviors

Actual Behavior

ipam_service creation fails due to missing ports argument. If imported (see #51 ) the state shows an empty port variable and setting port has no effect in netbox.

Expected Behavior

Service can be created and ports can be read back from netbox

Steps to Reproduce

  1. terraform apply

Fixes

See amhn@7b801ea for a working version.
I have no experience with go, so I had to disable the validate functions in vendor/github.com/netbox-community/go-netbox/netbox/models/service.go and vendor/github.com/netbox-community/go-netbox/netbox/models/writable_service.go.

@amhn amhn added the bug Something isn't working label Mar 14, 2021
@smutel
Copy link
Owner

smutel commented Mar 15, 2021

Hello,

Currently this provider is using the go-netbox library which is for netbox 2.9 only.
The community around go-netbox is not really active ...

Each major version of this provider is for one version of netbox.
I keep this issue opened and will see if it's still there with go-netbox for netbox 2.10.

Regards,

@smutel smutel added the netbox-version-not-compatible Need a new version of go-netbox/provider to manage this issue label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working netbox-version-not-compatible Need a new version of go-netbox/provider to manage this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants