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

Fix broken update request on netbox_location - missing site_id #307

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

nneul
Copy link
Contributor

@nneul nneul commented Dec 9, 2022

Currently, a location rename does not function due to missing 'site_id' in the PATCH request. This adds that to the API call.

@nneul nneul changed the title add site to update parm Fix broken update request on netbox_location - missing site_id Dec 9, 2022
@nneul
Copy link
Contributor Author

nneul commented Dec 9, 2022

  ~ update in-place

Terraform will perform the following actions:

  # netbox_location.sjc_nneul will be updated in-place
  ~ resource "netbox_location" "sjc_nneul" {
        id        = "67"
      ~ name      = "NNEUL" -> "NNEUL2"
        tags      = []
        # (3 unchanged attributes hidden)
    }

Plan: 0 to add, 1 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_location.sjc_nneul: Modifying... [id=67]
╷
│ Error: [PATCH /dcim/locations/{id}/][400] dcim_locations_partial_update default  map[site:[This field may not be null.]]
│ 
│   with netbox_location.sjc_nneul,
│   on locations.tf line 108, in resource "netbox_location" "sjc_nneul":108: resource "netbox_location" "sjc_nneul" {
│ 
╵

afterwards:

  # netbox_location.sjc_nneul will be updated in-place
  ~ resource "netbox_location" "sjc_nneul" {
        id        = "67"
      ~ name      = "NNEUL" -> "NNEUL2"
        tags      = []
        # (3 unchanged attributes hidden)
    }

Plan: 0 to add, 1 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_location.sjc_nneul: Modifying... [id=67]
netbox_location.sjc_nneul: Modifications complete after 0s [id=67]
Releasing state lock. This may take a few moments...

and other variations changing slug and name+slug.

@nneul
Copy link
Contributor Author

nneul commented Dec 13, 2022

@fbreckle Would you be able to review this for merge?

@fbreckle
Copy link
Collaborator

fyi: I added a test to your commit that failed before applying your fix

@fbreckle fbreckle merged commit 1a629c9 into e-breuninger:master Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants