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 validate custom_field on JSON value instead of label #459

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

menselman
Copy link

Terraform validate currently only allows the labelJSON on custom_fields, which is 'JSON'. See example below:

$ terraform validate
│ Error: expected type to be one of [text integer boolean date url select multiselect JSON], got json
│ 
│   with netbox_custom_field

But the actual netbox API when deploying a custom_field is expecting the valueJSON 'json'. See example below:

│ Error: [POST /extras/custom-fields/][400] extras_custom-fields_create default  map[type:[JSON is not a valid choice.]]
│ 
│   with module.am_netbox_tenants.netbox_custom_field,

Looking also at the other validators on L36-L42, this seems like a typo/mistake

@menselman menselman changed the title Fix validate on JSON value instead of label Fix validate custom_field on JSON value instead of label Aug 23, 2023
@fbreckle
Copy link
Collaborator

I added a test that verifies the wrong behavior, i.e. the test fails without your fix but succeeds with it.

@fbreckle fbreckle merged commit 6243087 into e-breuninger:master Sep 13, 2023
13 checks passed
@menselman menselman deleted the fix/custom_fields_check branch September 19, 2023 13:47
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