Open FalcoSuessgott opened 3 years ago
Hi @FalcoSuessgott ,
Thanks for opening the issue, I was just reading the custom field docs to try and get a bit more context and was wondering about the following:
definitions:
Secret:
type: "object"
required:
...
properties:
...
custom_fields:
title: "Custom fields"
type: "array"
items:
type: "object"
properties:
type:
description: "custom property type, must be one of the supported types as specified in the regex"
regex: "string|integer|boolean|date|url|selection|multiple_selection"
type: string
value:
type: string
{
"id": 123,
"url": "http://localhost:8000/api/dcim/sites/123/",
"name": "Raleigh 42",
...
"custom_fields": {
"deployed": "2018-06-19",
"site_code": "US-NC-RAL42"
},
...
Hope that helps!
Thanks Dani
Hi @FalcoSuessgott ,
Just wanted to follow up on this and see whether the previous response help at all. Reading again the error you got from the terraform provider I wonder if removing the Default from the OpenApi spec for the object property might also unblock you:
"Secret": {
"required": [
"assigned_object_type",
"assigned_object_id",
"role",
"plaintext"
],
"type": "object",
"properties": {
"id": {
"title": "ID",
"type": "integer",
"readOnly": true
},
[....]
"custom_fields": {
"title": "Custom fields",
"type": "object",
},
Currently, Terraform does not support setting defaults for fields other than primitives.
Thanks, Dani
Is your feature request related to a problem?
We want to use that provider as a netbox terraform provider, which supports OpenAPIv2.
Currently defintions of type objects without any properties are not supported. Netbox offers the possibility to add custom fields to objects. Those custom fields can have various data types (bool, string, date, ...).
Since in the OpenAPI spec those custom_fields are represented as objects without any properties:
Currently the provider responds the following:
As a terraform schema,
custom_fields
are represented as the followingDescribe the solution you'd like
It would be nice to have maps supported or to find a workaround to get that provider working with empty objects.
Describe alternatives you've considered
Maybe you can give us some hints where to start implementing this feature on our own.
Checklist (for admin only)
Don't forget to go through the checklist to make sure the issue is created properly: