terraform-provider-netbox icon indicating copy to clipboard operation
terraform-provider-netbox copied to clipboard

Add custom fields for prefix

Open jgrexa opened this issue 2 years ago • 8 comments

Add support for custom_fields in prefix resource. Solution taken from https://github.com/smutel/terraform-provider-netbox, it should fix also issues mentioned in https://github.com/e-breuninger/terraform-provider-netbox/pull/143. If this approach is acceptable, I can enhance the PR also for the rest of the resources.

Tests passed ok.

Custom fields should be defined using blocks:

custom_field {
  name = "testfield"
  type = "text"
  value = "tesval"
}
custom_field {
  name = "name"
  type = "text"
  value = "testname1"
}

jgrexa avatar Sep 01 '22 13:09 jgrexa

Hello,

I'm not sure but i think that this code can be reused to solved my issue on virtual machine. My issue is a bug in custom field integration on virtual machine resource.

Issue: https://github.com/e-breuninger/terraform-provider-netbox/issues/203

Regards,

Genesys05 avatar Sep 02 '22 03:09 Genesys05

Hello,

I'm not sure but i think that this code can be reused to solved my issue on virtual machine. My issue is a bug in custom field integration on virtual machine resource.

Issue: #203

Regards,

Hi, I have tested multiple choice cf with

custom_field {
  name = "test"
  type = "multiple"
  value = "value1,value2"
}

and is working ok.

jgrexa avatar Sep 02 '22 07:09 jgrexa

I not saw that you apply custom fields on all resources. It's perfect.

Thank you.

Genesys05 avatar Sep 06 '22 08:09 Genesys05

@fbreckle Can you merge this PR for next release ?

Because the custom field is a very important feature and it's very cool.

Thank you, Regards

Genesys05 avatar Sep 09 '22 07:09 Genesys05

Hi,

Thank you for your PR!

Just chiming in quickly to say that I saw this MR. I do not personally use custom fields (CFs) and am currently not really aware how they work in NetBox. This means reviewing this will take some time.

I have to say that I am not a big fan of having to repeat the type when using the CFs, but I am not sure if it is possible to get around that.

Some patience, please!

fbreckle avatar Sep 12 '22 21:09 fbreckle

Adding some global tests for each custom_field type could be a good idea to avoid surprises. And the PR title is a little bit confusing as you added the new schema to virtual machines, sites, locations, prefixes, etc. 😅

gillg avatar Sep 22 '22 08:09 gillg

Can you confirm the behaviour :

  • if the field is defined in TF but not exists in netbox : FAILURE

correct

  • if a field is not defined in TF but exists in netbox TF refresh will skip it and not see any change

correct

  • it supports other opbject ID (from a datasource) as reference if netbox type is "Object"

object type is not supported now

jgrexa avatar Oct 07 '22 19:10 jgrexa

Adding some global tests for each custom_field type could be a good idea to avoid surprises. And the PR title is a little bit confusing as you added the new schema to virtual machines, sites, locations, prefixes, etc. 😅

I will add tests for other supported types.

jgrexa avatar Oct 07 '22 20:10 jgrexa

Hi all, any update on this?

luispcoutinho avatar Nov 22 '22 09:11 luispcoutinho

Hi, any chance to have this feature soon?

misastovicek avatar Jan 19 '23 16:01 misastovicek

I will no longer be participating on this PR. I have migrated my use case to different Netbox provider.

jgrexa avatar Mar 01 '23 12:03 jgrexa