From c770ce9d5a0a1918e52189bdd6a99ff68a60337e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Nie=C3=9F?= Date: Sun, 30 Oct 2022 13:32:01 +0100 Subject: [PATCH 1/3] feat: Add suppport for missing customfield types --- examples/main.tf | 418 ++++++++++++++++-- .../netbox_ipam_aggregate/resource.tf | 38 +- .../netbox_ipam_ip_addresses/resource.tf | 38 +- .../netbox_ipam_ip_range/resource.tf | 38 +- .../resources/netbox_ipam_prefix/resource.tf | 38 +- .../resources/netbox_ipam_service/resource.tf | 38 +- .../resources/netbox_ipam_vlan/resource.tf | 38 +- .../netbox_tenancy_contact/resource.tf | 38 +- .../netbox_tenancy_contact_group/resource.tf | 38 +- .../netbox_tenancy_contact_role/resource.tf | 38 +- .../netbox_tenancy_tenant/resource.tf | 38 +- .../resource.tf | 38 +- .../netbox_virtualization_vm/resource.tf | 38 +- netbox/resource_netbox_ipam_aggregate.go | 27 +- netbox/resource_netbox_ipam_ip_addresses.go | 27 +- netbox/resource_netbox_ipam_ip_range.go | 27 +- netbox/resource_netbox_ipam_prefix.go | 27 +- netbox/resource_netbox_ipam_service.go | 27 +- netbox/resource_netbox_ipam_vlan.go | 36 +- netbox/resource_netbox_tenancy_contact.go | 36 +- .../resource_netbox_tenancy_contact_group.go | 31 +- .../resource_netbox_tenancy_contact_role.go | 27 +- netbox/resource_netbox_tenancy_tenant.go | 27 +- ...esource_netbox_virtualization_interface.go | 27 +- netbox/resource_netbox_virtualization_vm.go | 27 +- netbox/util.go | 126 +++++- 26 files changed, 927 insertions(+), 419 deletions(-) diff --git a/examples/main.tf b/examples/main.tf index 24312c14c..017591fa7 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -40,7 +40,7 @@ resource "netbox_tenancy_tenant" "tenant_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -51,9 +51,39 @@ resource "netbox_tenancy_tenant" "tenant_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -143,7 +173,7 @@ resource "netbox_ipam_vlan" "vlan_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -154,9 +184,39 @@ resource "netbox_ipam_vlan" "vlan_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -202,7 +262,7 @@ resource "netbox_ipam_prefix" "prefix_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -213,9 +273,39 @@ resource "netbox_ipam_prefix" "prefix_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -265,7 +355,7 @@ resource "netbox_ipam_ip_range" "range_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -276,9 +366,39 @@ resource "netbox_ipam_ip_range" "range_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -326,7 +446,7 @@ resource "netbox_ipam_ip_addresses" "ip_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -337,9 +457,39 @@ resource "netbox_ipam_ip_addresses" "ip_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -410,7 +560,7 @@ resource "netbox_virtualization_vm" "vm_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -421,9 +571,39 @@ resource "netbox_virtualization_vm" "vm_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -466,7 +646,7 @@ resource "netbox_ipam_service" "service_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -477,9 +657,39 @@ resource "netbox_ipam_service" "service_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -532,7 +742,7 @@ resource "netbox_ipam_aggregate" "aggregate_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -543,9 +753,39 @@ resource "netbox_ipam_aggregate" "aggregate_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -594,7 +834,7 @@ resource "netbox_tenancy_contact" "contact" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -605,9 +845,39 @@ resource "netbox_tenancy_contact" "contact" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -652,7 +922,7 @@ resource "netbox_tenancy_contact_group" "contact_group_01" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -663,9 +933,39 @@ resource "netbox_tenancy_contact_group" "contact_group_01" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } @@ -717,7 +1017,7 @@ resource "netbox_tenancy_contact_role" "contact_role_01" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -728,9 +1028,39 @@ resource "netbox_tenancy_contact_role" "contact_role_01" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_ipam_aggregate/resource.tf b/examples/resources/netbox_ipam_aggregate/resource.tf index 2363ddee1..ca20ecaed 100644 --- a/examples/resources/netbox_ipam_aggregate/resource.tf +++ b/examples/resources/netbox_ipam_aggregate/resource.tf @@ -34,7 +34,7 @@ resource "netbox_ipam_aggregate" "aggregate_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -45,8 +45,38 @@ resource "netbox_ipam_aggregate" "aggregate_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_ipam_ip_addresses/resource.tf b/examples/resources/netbox_ipam_ip_addresses/resource.tf index e246338de..d3edcb914 100644 --- a/examples/resources/netbox_ipam_ip_addresses/resource.tf +++ b/examples/resources/netbox_ipam_ip_addresses/resource.tf @@ -34,7 +34,7 @@ resource "netbox_ipam_ip_addresses" "ip_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -45,9 +45,39 @@ resource "netbox_ipam_ip_addresses" "ip_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_ipam_ip_range/resource.tf b/examples/resources/netbox_ipam_ip_range/resource.tf index fb479d520..9adfba47e 100644 --- a/examples/resources/netbox_ipam_ip_range/resource.tf +++ b/examples/resources/netbox_ipam_ip_range/resource.tf @@ -36,7 +36,7 @@ resource "netbox_ipam_ip_range" "range_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -47,8 +47,38 @@ resource "netbox_ipam_ip_range" "range_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_ipam_prefix/resource.tf b/examples/resources/netbox_ipam_prefix/resource.tf index 3e85518ba..c4fd92a55 100644 --- a/examples/resources/netbox_ipam_prefix/resource.tf +++ b/examples/resources/netbox_ipam_prefix/resource.tf @@ -37,7 +37,7 @@ resource "netbox_ipam_prefix" "prefix_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -48,9 +48,39 @@ resource "netbox_ipam_prefix" "prefix_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_ipam_service/resource.tf b/examples/resources/netbox_ipam_service/resource.tf index 2dd882740..9c7cb9dd0 100644 --- a/examples/resources/netbox_ipam_service/resource.tf +++ b/examples/resources/netbox_ipam_service/resource.tf @@ -37,7 +37,7 @@ resource "netbox_ipam_service" "service_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -48,8 +48,38 @@ resource "netbox_ipam_service" "service_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_ipam_vlan/resource.tf b/examples/resources/netbox_ipam_vlan/resource.tf index d100fba23..3759aa423 100644 --- a/examples/resources/netbox_ipam_vlan/resource.tf +++ b/examples/resources/netbox_ipam_vlan/resource.tf @@ -38,7 +38,7 @@ resource "netbox_ipam_vlan" "vlan_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -49,8 +49,38 @@ resource "netbox_ipam_vlan" "vlan_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_tenancy_contact/resource.tf b/examples/resources/netbox_tenancy_contact/resource.tf index b775e318a..32e5a9732 100644 --- a/examples/resources/netbox_tenancy_contact/resource.tf +++ b/examples/resources/netbox_tenancy_contact/resource.tf @@ -38,7 +38,7 @@ resource "netbox_tenancy_contact" "contact_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -49,8 +49,38 @@ resource "netbox_tenancy_contact" "contact_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_tenancy_contact_group/resource.tf b/examples/resources/netbox_tenancy_contact_group/resource.tf index 9762168a4..84a8d7dfd 100644 --- a/examples/resources/netbox_tenancy_contact_group/resource.tf +++ b/examples/resources/netbox_tenancy_contact_group/resource.tf @@ -35,7 +35,7 @@ resource "netbox_tenancy_contact_group" "contact_group_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -46,8 +46,38 @@ resource "netbox_tenancy_contact_group" "contact_group_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_tenancy_contact_role/resource.tf b/examples/resources/netbox_tenancy_contact_role/resource.tf index b749c435a..a55192929 100644 --- a/examples/resources/netbox_tenancy_contact_role/resource.tf +++ b/examples/resources/netbox_tenancy_contact_role/resource.tf @@ -34,7 +34,7 @@ resource "netbox_tenancy_contact_role" "contact_role_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -45,8 +45,38 @@ resource "netbox_tenancy_contact_role" "contact_role_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_tenancy_tenant/resource.tf b/examples/resources/netbox_tenancy_tenant/resource.tf index 5571c3b47..fe6e1c65b 100644 --- a/examples/resources/netbox_tenancy_tenant/resource.tf +++ b/examples/resources/netbox_tenancy_tenant/resource.tf @@ -36,7 +36,7 @@ resource "netbox_tenancy_tenant" "tenant_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -47,8 +47,38 @@ resource "netbox_tenancy_tenant" "tenant_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_virtualization_interface/resource.tf b/examples/resources/netbox_virtualization_interface/resource.tf index d0b4f8a93..ec686474d 100644 --- a/examples/resources/netbox_virtualization_interface/resource.tf +++ b/examples/resources/netbox_virtualization_interface/resource.tf @@ -31,7 +31,7 @@ resource "netbox_virtualization_interface" "interface_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -42,8 +42,38 @@ resource "netbox_virtualization_interface" "interface_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/examples/resources/netbox_virtualization_vm/resource.tf b/examples/resources/netbox_virtualization_vm/resource.tf index d2aeb0704..44eb0845a 100644 --- a/examples/resources/netbox_virtualization_vm/resource.tf +++ b/examples/resources/netbox_virtualization_vm/resource.tf @@ -43,7 +43,7 @@ resource "netbox_virtualization_vm" "vm_test" { custom_field { name = "cf_selection" - type = "selection" + type = "select" value = "1" } @@ -54,8 +54,38 @@ resource "netbox_virtualization_vm" "vm_test" { } custom_field { - name = "cf_multiple_selection" - type = "multiple" - value = "0,1" + name = "cf_multi_selection" + type = "multiselect" + value = jsonencode([ + "0", + "1" + ]) + } + + custom_field { + name = "cf_json" + type = "json" + value = jsonencode({ + stringvalue = "string" + boolvalue = false + dictionary = { + numbervalue = 5 + } + }) + } + + custom_field { + name = "cf_object" + type = "object" + value = 1 + } + + custom_field { + name = "cf_multi_object" + type = "multiobject" + value = jsonencode([ + 1, + 2 + ]) } } diff --git a/netbox/resource_netbox_ipam_aggregate.go b/netbox/resource_netbox_ipam_aggregate.go index e9a7af617..5b3141e0c 100644 --- a/netbox/resource_netbox_ipam_aggregate.go +++ b/netbox/resource_netbox_ipam_aggregate.go @@ -38,32 +38,7 @@ func resourceNetboxIpamAggregate() *schema.Resource { Computed: true, Description: "Date when this aggregate was created.", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this aggregate (ipam module).", - }, + "custom_field": &customFieldSchema, "date_added": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_ipam_ip_addresses.go b/netbox/resource_netbox_ipam_ip_addresses.go index 0da94a37e..9bbcd0c21 100644 --- a/netbox/resource_netbox_ipam_ip_addresses.go +++ b/netbox/resource_netbox_ipam_ip_addresses.go @@ -51,32 +51,7 @@ func resourceNetboxIpamIPAddresses() *schema.Resource { Computed: true, Description: "The content type of this IP address (ipam module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this IP address (ipam module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_ipam_ip_range.go b/netbox/resource_netbox_ipam_ip_range.go index 90dd1dd75..40142a9bd 100644 --- a/netbox/resource_netbox_ipam_ip_range.go +++ b/netbox/resource_netbox_ipam_ip_range.go @@ -30,32 +30,7 @@ func resourceNetboxIpamIPRange() *schema.Resource { Computed: true, Description: "The content type of this prefix (ipam module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this prefix (ipam module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_ipam_prefix.go b/netbox/resource_netbox_ipam_prefix.go index 7eddeba82..267eb7cdb 100644 --- a/netbox/resource_netbox_ipam_prefix.go +++ b/netbox/resource_netbox_ipam_prefix.go @@ -30,32 +30,7 @@ func resourceNetboxIpamPrefix() *schema.Resource { Computed: true, Description: "The content type of this prefix (ipam module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this prefix (ipam module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_ipam_service.go b/netbox/resource_netbox_ipam_service.go index bb7253210..2a29b1dc2 100644 --- a/netbox/resource_netbox_ipam_service.go +++ b/netbox/resource_netbox_ipam_service.go @@ -30,32 +30,7 @@ func resourceNetboxIpamService() *schema.Resource { Computed: true, Description: "The content type of this service (ipam module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this service (ipam module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_ipam_vlan.go b/netbox/resource_netbox_ipam_vlan.go index 882cd580e..525141239 100644 --- a/netbox/resource_netbox_ipam_vlan.go +++ b/netbox/resource_netbox_ipam_vlan.go @@ -30,32 +30,7 @@ func resourceNetboxIpamVlan() *schema.Resource { Computed: true, Description: "The content type of this vlan (ipam module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this vlan (ipam module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, @@ -285,6 +260,11 @@ func resourceNetboxIpamVlanRead(ctx context.Context, d *schema.ResourceData, func resourceNetboxIpamVlanUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { client := m.(*netboxclient.NetBoxAPI) + dropFields := []string{ + "created", + "last_updated", + } + emptyFields := make(map[string]interface{}) params := &models.WritableVLAN{} // Required parameters @@ -313,6 +293,8 @@ func resourceNetboxIpamVlanUpdate(ctx context.Context, d *schema.ResourceData, if groupID != 0 { params.Group = &groupID } + } else { + dropFields = append(dropFields, "group") } if d.HasChange("role_id") { @@ -353,7 +335,7 @@ func resourceNetboxIpamVlanUpdate(ctx context.Context, d *schema.ResourceData, resource.SetID(resourceID) - _, err = client.Ipam.IpamVlansPartialUpdate(resource, nil) + _, err = client.Ipam.IpamVlansPartialUpdate(resource, nil, newRequestModifierOperation(emptyFields, dropFields)) if err != nil { return diag.FromErr(err) } diff --git a/netbox/resource_netbox_tenancy_contact.go b/netbox/resource_netbox_tenancy_contact.go index a618374fa..db3e48091 100644 --- a/netbox/resource_netbox_tenancy_contact.go +++ b/netbox/resource_netbox_tenancy_contact.go @@ -51,32 +51,7 @@ func resourceNetboxTenancyContact() *schema.Resource { Computed: true, Description: "The content type of this contact (tenancy module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this contact (tenancy module).", - }, + "custom_field": &customFieldSchema, "email": { Type: schema.TypeString, Optional: true, @@ -285,6 +260,11 @@ func resourceNetboxTenancyContactRead(ctx context.Context, d *schema.ResourceDat func resourceNetboxTenancyContactUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { client := m.(*netboxclient.NetBoxAPI) + dropFields := []string{ + "created", + "last_updated", + } + emptyFields := make(map[string]interface{}) params := &models.WritableContact{} // Required parameters @@ -314,6 +294,8 @@ func resourceNetboxTenancyContactUpdate(ctx context.Context, d *schema.ResourceD } else { params.Group = &groupID } + } else { + dropFields = append(dropFields, "group") } if d.HasChange("custom_field") { @@ -358,7 +340,7 @@ func resourceNetboxTenancyContactUpdate(ctx context.Context, d *schema.ResourceD resource.SetID(resourceID) - _, err = client.Tenancy.TenancyContactsPartialUpdate(resource, nil) + _, err = client.Tenancy.TenancyContactsPartialUpdate(resource, nil, newRequestModifierOperation(emptyFields, dropFields)) if err != nil { return diag.FromErr(err) } diff --git a/netbox/resource_netbox_tenancy_contact_group.go b/netbox/resource_netbox_tenancy_contact_group.go index f7c74424e..87096eef8 100644 --- a/netbox/resource_netbox_tenancy_contact_group.go +++ b/netbox/resource_netbox_tenancy_contact_group.go @@ -31,32 +31,7 @@ func resourceNetboxTenancyContactGroup() *schema.Resource { Computed: true, Description: "The content type of this contact group (tenancy module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this contact group (tenancy module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, @@ -221,7 +196,9 @@ func resourceNetboxTenancyContactGroupUpdate(ctx context.Context, d *schema.Reso params.Slug = &slug parentID := int64(d.Get("parent_id").(int)) - params.Parent = &parentID + if parentID != 0 { + params.Parent = &parentID + } if d.HasChange("custom_field") { stateCustomFields, resourceCustomFields := d.GetChange("custom_field") diff --git a/netbox/resource_netbox_tenancy_contact_role.go b/netbox/resource_netbox_tenancy_contact_role.go index d59332c7f..24e95e16f 100644 --- a/netbox/resource_netbox_tenancy_contact_role.go +++ b/netbox/resource_netbox_tenancy_contact_role.go @@ -31,32 +31,7 @@ func resourceNetboxTenancyContactRole() *schema.Resource { Computed: true, Description: "The content type of this contact role (tenancy module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this contact role (tenancy module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_tenancy_tenant.go b/netbox/resource_netbox_tenancy_tenant.go index fdea99a45..c59c5e83b 100644 --- a/netbox/resource_netbox_tenancy_tenant.go +++ b/netbox/resource_netbox_tenancy_tenant.go @@ -37,32 +37,7 @@ func resourceNetboxTenancyTenant() *schema.Resource { Computed: true, Description: "The content type of this tenant (tenancy module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this tenant (tenancy module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_virtualization_interface.go b/netbox/resource_netbox_virtualization_interface.go index 7e16fea5f..db75a9e2d 100644 --- a/netbox/resource_netbox_virtualization_interface.go +++ b/netbox/resource_netbox_virtualization_interface.go @@ -31,32 +31,7 @@ func resourceNetboxVirtualizationInterface() *schema.Resource { Computed: true, Description: "The content type of this interface (virtualization module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this interface (virtualization module).", - }, + "custom_field": &customFieldSchema, "description": { Type: schema.TypeString, Optional: true, diff --git a/netbox/resource_netbox_virtualization_vm.go b/netbox/resource_netbox_virtualization_vm.go index 45a02e3be..4f079022e 100644 --- a/netbox/resource_netbox_virtualization_vm.go +++ b/netbox/resource_netbox_virtualization_vm.go @@ -45,32 +45,7 @@ func resourceNetboxVirtualizationVM() *schema.Resource { Computed: true, Description: "The content type of this VM (virtualization module).", }, - "custom_field": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the existing custom field.", - }, - "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"text", "integer", "boolean", - "date", "url", "selection", "multiple"}, false), - Description: "Type of the existing custom field (text, integer, boolean, url, selection, multiple).", - }, - "value": { - Type: schema.TypeString, - Required: true, - Description: "Value of the existing custom field.", - }, - }, - }, - Description: "Existing custom fields to associate to this VM (virtualization module).", - }, + "custom_field": &customFieldSchema, "disk": { Type: schema.TypeInt, Optional: true, diff --git a/netbox/util.go b/netbox/util.go index 1e52ebe14..6a86fc9f2 100644 --- a/netbox/util.go +++ b/netbox/util.go @@ -10,6 +10,8 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" netboxclient "github.com/smutel/go-netbox/v3/netbox/client" "github.com/smutel/go-netbox/v3/netbox/client/ipam" "github.com/smutel/go-netbox/v3/netbox/client/virtualization" @@ -21,6 +23,38 @@ const VMInterfaceType string = "virtualization.vminterface" // Boolean string for custom field const CustomFieldBoolean = "boolean" +const CustomFieldJSON = "json" +const CustomFieldMultiSelectLegacy = "multiple" +const CustomFieldMultiSelect = "multiselect" +const CustomFieldObject = "object" +const CustomFieldMultiObject = "multiobject" + +var customFieldSchema = schema.Schema{ + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Name of the existing custom field.", + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"text", "longtext", "integer", CustomFieldBoolean, + "date", "url", CustomFieldJSON, "select", CustomFieldMultiSelect, CustomFieldObject, CustomFieldMultiObject, CustomFieldMultiSelectLegacy, "selection"}, false), + Description: "Type of the existing custom field (text, longtext, integer, boolean, date, url, json, select, multiselect, object, multiobject, selection (deprecated), multiple(deprecated)).", + }, + "value": { + Type: schema.TypeString, + Required: true, + Description: "Value of the existing custom field.", + }, + }, + }, + Description: "Existing custom fields to associate to this ressource.", +} func expandToInt64Slice(v []interface{}) []int64 { s := make([]int64, len(v)) @@ -200,6 +234,38 @@ func convertArrayInterfaceString(arrayInterface []interface{}) string { return result } +func convertArrayInterfaceJSONString(arrayInterface []interface{}) string { + var arrayString []interface{} + + for _, item := range arrayInterface { + switch v := item.(type) { + case map[string]interface{}: + arrayString = append(arrayString, string(v["id"].(json.Number))) + default: + arrayString = append(arrayString, v) + } + } + + if len(arrayString) > 1 { + switch arrayString[0].(type) { + case json.Number: + sort.Slice(arrayString, func(i, j int) bool { + return arrayString[i].(json.Number) < arrayString[j].(json.Number) + }) + case string: + sort.Slice(arrayString, func(i, j int) bool { + return arrayString[i].(string) < arrayString[j].(string) + }) + default: + panic("") + } + } + jsonValue, _ := json.Marshal(arrayString) + result := string(jsonValue) + + return result +} + // Pick the custom fields in the state file and update values with data from API func updateCustomFieldsFromAPI(stateCustomFields, customFields interface{}) []map[string]string { var tfCms []map[string]string @@ -215,20 +281,25 @@ func updateCustomFieldsFromAPI(stateCustomFields, customFields interface{}) []ma cm["name"] = key cm["type"] = stateCustomField.(map[string]interface{})["type"].(string) - if value != nil { + if value != nil && cm["type"] == CustomFieldJSON { + jsonValue, _ := json.Marshal(value) + cm["value"] = string(jsonValue) + } else if value != nil { switch v := value.(type) { case []interface{}: - strValue = convertArrayInterfaceString(v) + if cm["type"] == CustomFieldMultiSelectLegacy { + strValue = convertArrayInterfaceString(v) + } else if cm["type"] == CustomFieldObject { + strValue = string(value.([]interface{})[0].(map[string]interface{})["id"].(json.Number)) + } else { + strValue = convertArrayInterfaceJSONString(v) + } + case map[string]interface{}: + strValue = string(v["id"].(json.Number)) default: strValue = fmt.Sprintf("%v", v) } - if strValue == "1" && cm["type"] == CustomFieldBoolean { - strValue = "true" - } else if strValue == "0" && cm["type"] == CustomFieldBoolean { - strValue = "false" - } - cm["value"] = strValue } else { cm["value"] = "" @@ -260,20 +331,51 @@ func convertCustomFieldsFromTerraformToAPI(stateCustomFields []interface{}, cust cfValue := customField["value"].(string) if len(cfValue) > 0 { - if cfType == "integer" { + switch cfType { + case "integer": cfValueInt, _ := strconv.Atoi(cfValue) toReturn[cfName] = cfValueInt - } else if cfType == CustomFieldBoolean { + case CustomFieldBoolean: if cfValue == "true" { toReturn[cfName] = true } else if cfValue == "false" { toReturn[cfName] = false } - } else if cfType == "multiple" { + case CustomFieldMultiSelectLegacy: cfValueArray := strings.Split(cfValue, ",") sort.Strings(cfValueArray) toReturn[cfName] = cfValueArray - } else { + case CustomFieldJSON: + jsonMap := make(map[string]interface{}) + err := json.Unmarshal([]byte(cfValue), &jsonMap) + if err != nil { + continue + } + toReturn[cfName] = jsonMap + case CustomFieldMultiSelect: + var jsonList []interface{} + err := json.Unmarshal([]byte(cfValue), &jsonList) + if err != nil { + continue + } + sort.Slice(jsonList, func(i, j int) bool { + return jsonList[i].(string) < jsonList[j].(string) + }) + toReturn[cfName] = jsonList + case CustomFieldObject: + cfValueInt, _ := strconv.Atoi(cfValue) + toReturn[cfName] = []int{cfValueInt} + case CustomFieldMultiObject: + var jsonList []interface{} + err := json.Unmarshal([]byte(cfValue), &jsonList) + if err != nil { + continue + } + sort.Slice(jsonList, func(i, j int) bool { + return jsonList[i].(string) < jsonList[j].(string) + }) + toReturn[cfName] = jsonList + default: toReturn[cfName] = cfValue } } else { From e8f2d54ff4d5124b6a7ab988bc87989fdaff34f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Nie=C3=9F?= Date: Fri, 4 Nov 2022 16:08:24 +0100 Subject: [PATCH 2/3] docs: Change examples to use data source --- examples/main.tf | 76 +++++++++++-------- .../netbox_ipam_aggregate/resource.tf | 6 +- .../netbox_ipam_ip_addresses/resource.tf | 6 +- .../netbox_ipam_ip_range/resource.tf | 6 +- .../resources/netbox_ipam_prefix/resource.tf | 6 +- .../resources/netbox_ipam_service/resource.tf | 6 +- .../resources/netbox_ipam_vlan/resource.tf | 6 +- .../netbox_tenancy_contact/resource.tf | 6 +- .../netbox_tenancy_contact_group/resource.tf | 6 +- .../netbox_tenancy_contact_role/resource.tf | 6 +- .../netbox_tenancy_tenant/resource.tf | 6 +- .../resource.tf | 6 +- .../netbox_virtualization_vm/resource.tf | 6 +- 13 files changed, 79 insertions(+), 69 deletions(-) diff --git a/examples/main.tf b/examples/main.tf index 017591fa7..0ed55c37c 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -74,15 +74,15 @@ resource "netbox_tenancy_tenant" "tenant_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -207,15 +207,15 @@ resource "netbox_ipam_vlan" "vlan_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -296,15 +296,15 @@ resource "netbox_ipam_prefix" "prefix_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -389,15 +389,15 @@ resource "netbox_ipam_ip_range" "range_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -480,15 +480,15 @@ resource "netbox_ipam_ip_addresses" "ip_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -513,6 +513,15 @@ data "netbox_dcim_platform" "platform_test" { slug = "Debian_10" } +data "netbox_dcim_platform" "platform_test2" { + slug = "ubuntu_22_04" +} + +data "netbox_dcim_platform" "platform_test3" { + slug = "ubuntu_22_10" +} + + resource "netbox_virtualization_vm" "vm_test" { cluster_id = data.netbox_virtualization_cluster.cluster_test.id name = "test" @@ -594,15 +603,15 @@ resource "netbox_virtualization_vm" "vm_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -680,15 +689,15 @@ resource "netbox_ipam_service" "service_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -776,15 +785,15 @@ resource "netbox_ipam_aggregate" "aggregate_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -868,15 +877,15 @@ resource "netbox_tenancy_contact" "contact" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -956,15 +965,15 @@ resource "netbox_tenancy_contact_group" "contact_group_01" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } @@ -1051,15 +1060,16 @@ resource "netbox_tenancy_contact_role" "contact_role_01" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id, + "3" ]) } } diff --git a/examples/resources/netbox_ipam_aggregate/resource.tf b/examples/resources/netbox_ipam_aggregate/resource.tf index ca20ecaed..718abd6d7 100644 --- a/examples/resources/netbox_ipam_aggregate/resource.tf +++ b/examples/resources/netbox_ipam_aggregate/resource.tf @@ -68,15 +68,15 @@ resource "netbox_ipam_aggregate" "aggregate_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_ipam_ip_addresses/resource.tf b/examples/resources/netbox_ipam_ip_addresses/resource.tf index d3edcb914..9ecc9b694 100644 --- a/examples/resources/netbox_ipam_ip_addresses/resource.tf +++ b/examples/resources/netbox_ipam_ip_addresses/resource.tf @@ -68,15 +68,15 @@ resource "netbox_ipam_ip_addresses" "ip_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_ipam_ip_range/resource.tf b/examples/resources/netbox_ipam_ip_range/resource.tf index 9adfba47e..0d4a26552 100644 --- a/examples/resources/netbox_ipam_ip_range/resource.tf +++ b/examples/resources/netbox_ipam_ip_range/resource.tf @@ -70,15 +70,15 @@ resource "netbox_ipam_ip_range" "range_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_ipam_prefix/resource.tf b/examples/resources/netbox_ipam_prefix/resource.tf index c4fd92a55..7dd0e72b3 100644 --- a/examples/resources/netbox_ipam_prefix/resource.tf +++ b/examples/resources/netbox_ipam_prefix/resource.tf @@ -71,15 +71,15 @@ resource "netbox_ipam_prefix" "prefix_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_ipam_service/resource.tf b/examples/resources/netbox_ipam_service/resource.tf index 9c7cb9dd0..336e7b363 100644 --- a/examples/resources/netbox_ipam_service/resource.tf +++ b/examples/resources/netbox_ipam_service/resource.tf @@ -71,15 +71,15 @@ resource "netbox_ipam_service" "service_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_ipam_vlan/resource.tf b/examples/resources/netbox_ipam_vlan/resource.tf index 3759aa423..ddc43bd9a 100644 --- a/examples/resources/netbox_ipam_vlan/resource.tf +++ b/examples/resources/netbox_ipam_vlan/resource.tf @@ -72,15 +72,15 @@ resource "netbox_ipam_vlan" "vlan_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_tenancy_contact/resource.tf b/examples/resources/netbox_tenancy_contact/resource.tf index 32e5a9732..766e35e20 100644 --- a/examples/resources/netbox_tenancy_contact/resource.tf +++ b/examples/resources/netbox_tenancy_contact/resource.tf @@ -72,15 +72,15 @@ resource "netbox_tenancy_contact" "contact_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_tenancy_contact_group/resource.tf b/examples/resources/netbox_tenancy_contact_group/resource.tf index 84a8d7dfd..6e36297f8 100644 --- a/examples/resources/netbox_tenancy_contact_group/resource.tf +++ b/examples/resources/netbox_tenancy_contact_group/resource.tf @@ -69,15 +69,15 @@ resource "netbox_tenancy_contact_group" "contact_group_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_tenancy_contact_role/resource.tf b/examples/resources/netbox_tenancy_contact_role/resource.tf index a55192929..8f80c56a2 100644 --- a/examples/resources/netbox_tenancy_contact_role/resource.tf +++ b/examples/resources/netbox_tenancy_contact_role/resource.tf @@ -68,15 +68,15 @@ resource "netbox_tenancy_contact_role" "contact_role_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_tenancy_tenant/resource.tf b/examples/resources/netbox_tenancy_tenant/resource.tf index fe6e1c65b..9397ff09b 100644 --- a/examples/resources/netbox_tenancy_tenant/resource.tf +++ b/examples/resources/netbox_tenancy_tenant/resource.tf @@ -70,15 +70,15 @@ resource "netbox_tenancy_tenant" "tenant_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_virtualization_interface/resource.tf b/examples/resources/netbox_virtualization_interface/resource.tf index ec686474d..cc66e2436 100644 --- a/examples/resources/netbox_virtualization_interface/resource.tf +++ b/examples/resources/netbox_virtualization_interface/resource.tf @@ -65,15 +65,15 @@ resource "netbox_virtualization_interface" "interface_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } diff --git a/examples/resources/netbox_virtualization_vm/resource.tf b/examples/resources/netbox_virtualization_vm/resource.tf index 44eb0845a..9d914806a 100644 --- a/examples/resources/netbox_virtualization_vm/resource.tf +++ b/examples/resources/netbox_virtualization_vm/resource.tf @@ -77,15 +77,15 @@ resource "netbox_virtualization_vm" "vm_test" { custom_field { name = "cf_object" type = "object" - value = 1 + value = data.netbox_dcim_platform.platform_test.id } custom_field { name = "cf_multi_object" type = "multiobject" value = jsonencode([ - 1, - 2 + data.netbox_dcim_platform.platform_test.id, + data.netbox_dcim_platform.platform_test2.id ]) } } From 82f0213095846be16bc3a33052a030b36d7536d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Nie=C3=9F?= Date: Fri, 4 Nov 2022 16:06:48 +0100 Subject: [PATCH 3/3] ci: Convert exports into importable format --- examples/exports/v3.2/netbox_RIRs.csv | 2 -- examples/exports/v3.2/netbox_cluster types.csv | 2 -- examples/exports/v3.2/netbox_clusters.csv | 2 -- examples/exports/v3.2/netbox_custom fields.csv | 8 -------- examples/exports/v3.2/netbox_dcim_device roles.csv | 2 ++ examples/exports/v3.2/netbox_dcim_platforms.csv | 4 ++++ examples/exports/v3.2/netbox_dcim_sites.csv | 2 ++ examples/exports/v3.2/netbox_device roles.csv | 2 -- examples/exports/v3.2/netbox_extras_custom fields.csv | 11 +++++++++++ examples/exports/v3.2/netbox_extras_tags.csv | 3 +++ examples/exports/v3.2/netbox_ipam_RIRs.csv | 2 ++ examples/exports/v3.2/netbox_ipam_roles.csv | 3 +++ examples/exports/v3.2/netbox_platforms.csv | 2 -- examples/exports/v3.2/netbox_roles.csv | 3 --- examples/exports/v3.2/netbox_sites.csv | 2 -- examples/exports/v3.2/netbox_tags.csv | 3 --- .../v3.2/netbox_virtualization_cluster types.csv | 2 ++ .../exports/v3.2/netbox_virtualization_clusters.csv | 2 ++ 18 files changed, 31 insertions(+), 26 deletions(-) delete mode 100644 examples/exports/v3.2/netbox_RIRs.csv delete mode 100644 examples/exports/v3.2/netbox_cluster types.csv delete mode 100644 examples/exports/v3.2/netbox_clusters.csv delete mode 100644 examples/exports/v3.2/netbox_custom fields.csv create mode 100644 examples/exports/v3.2/netbox_dcim_device roles.csv create mode 100644 examples/exports/v3.2/netbox_dcim_platforms.csv create mode 100644 examples/exports/v3.2/netbox_dcim_sites.csv delete mode 100644 examples/exports/v3.2/netbox_device roles.csv create mode 100644 examples/exports/v3.2/netbox_extras_custom fields.csv create mode 100644 examples/exports/v3.2/netbox_extras_tags.csv create mode 100644 examples/exports/v3.2/netbox_ipam_RIRs.csv create mode 100644 examples/exports/v3.2/netbox_ipam_roles.csv delete mode 100644 examples/exports/v3.2/netbox_platforms.csv delete mode 100644 examples/exports/v3.2/netbox_roles.csv delete mode 100644 examples/exports/v3.2/netbox_sites.csv delete mode 100644 examples/exports/v3.2/netbox_tags.csv create mode 100644 examples/exports/v3.2/netbox_virtualization_cluster types.csv create mode 100644 examples/exports/v3.2/netbox_virtualization_clusters.csv diff --git a/examples/exports/v3.2/netbox_RIRs.csv b/examples/exports/v3.2/netbox_RIRs.csv deleted file mode 100644 index d37142ec3..000000000 --- a/examples/exports/v3.2/netbox_RIRs.csv +++ /dev/null @@ -1,2 +0,0 @@ -Name,Private,Aggregates,Description,ID,Slug,Tags,Created,Last updated -test,False,0,,1,test,,2022-09-24 14:04,2022-09-24 14:04 diff --git a/examples/exports/v3.2/netbox_cluster types.csv b/examples/exports/v3.2/netbox_cluster types.csv deleted file mode 100644 index 2c4d2d8ad..000000000 --- a/examples/exports/v3.2/netbox_cluster types.csv +++ /dev/null @@ -1,2 +0,0 @@ -Name,Clusters,Description,ID,Slug,Created,Last updated,Tags -test,1,,1,test,2022-09-24 13:50,2022-09-24 13:50, diff --git a/examples/exports/v3.2/netbox_clusters.csv b/examples/exports/v3.2/netbox_clusters.csv deleted file mode 100644 index b2b166f7b..000000000 --- a/examples/exports/v3.2/netbox_clusters.csv +++ /dev/null @@ -1,2 +0,0 @@ -Name,Type,Group,Tenant,Site,Devices,VMs,ID,Tenant Group,Comments,Contacts,Tags,Created,Last updated -test,test,,,,0,0,1,,,,,2022-09-24 13:50,2022-09-24 13:50 diff --git a/examples/exports/v3.2/netbox_custom fields.csv b/examples/exports/v3.2/netbox_custom fields.csv deleted file mode 100644 index ec2735137..000000000 --- a/examples/exports/v3.2/netbox_custom fields.csv +++ /dev/null @@ -1,8 +0,0 @@ -Name,Content types,Label,Type,Required,Description,ID,Weight,Default,Filter logic,Choices,Created,Last updated -cf_boolean,"virtualization.virtualmachine,tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,ipam.vlan,ipam.service,ipam.iprange",,Boolean (true/false),False,,1,100,,Loose,[],2022-09-24 13:52,2022-09-24 13:53 -cf_date,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,Date,False,,2,100,,Loose,[],2022-09-24 13:55,2022-09-24 13:55 -cf_integer,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,Integer,False,,4,100,,Loose,[],2022-09-24 13:59,2022-09-24 13:59 -cf_multiple_selection,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,Multiple selection,False,,7,100,,Loose,"['0', '1']",2022-09-24 14:03,2022-09-24 14:03 -cf_selection,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,Selection,False,,5,100,,Loose,"['0', '1']",2022-09-24 14:00,2022-09-24 14:00 -cf_text,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,Text,False,,3,100,,Loose,[],2022-09-24 13:56,2022-09-24 13:56 -cf_url,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,URL,False,,6,100,,Loose,[],2022-09-24 14:01,2022-09-24 14:01 diff --git a/examples/exports/v3.2/netbox_dcim_device roles.csv b/examples/exports/v3.2/netbox_dcim_device roles.csv new file mode 100644 index 000000000..e29334a4f --- /dev/null +++ b/examples/exports/v3.2/netbox_dcim_device roles.csv @@ -0,0 +1,2 @@ +name,color,vm_role,description,slug +test,9e9e9e,True,"Test Device Role",test diff --git a/examples/exports/v3.2/netbox_dcim_platforms.csv b/examples/exports/v3.2/netbox_dcim_platforms.csv new file mode 100644 index 000000000..dc7a7f3f1 --- /dev/null +++ b/examples/exports/v3.2/netbox_dcim_platforms.csv @@ -0,0 +1,4 @@ +name,description,slug +Debian_10,"Test platform",Debian_10 +"Ubuntu 22.04","Test platform",ubuntu_22_04 +"Ubuntu 22.10","Test platform",ubuntu_22_10 diff --git a/examples/exports/v3.2/netbox_dcim_sites.csv b/examples/exports/v3.2/netbox_dcim_sites.csv new file mode 100644 index 000000000..07516c54c --- /dev/null +++ b/examples/exports/v3.2/netbox_dcim_sites.csv @@ -0,0 +1,2 @@ +name,status,description,slug +pa3,active,"Test site",pa3 diff --git a/examples/exports/v3.2/netbox_device roles.csv b/examples/exports/v3.2/netbox_device roles.csv deleted file mode 100644 index 1c2780c34..000000000 --- a/examples/exports/v3.2/netbox_device roles.csv +++ /dev/null @@ -1,2 +0,0 @@ -Name,Devices,VMs,Color,VM Role,Description,ID,Slug,Tags,Created,Last updated -test,0,0,#9e9e9e,True,,1,test,,2022-09-24 13:51,2022-09-24 13:51 diff --git a/examples/exports/v3.2/netbox_extras_custom fields.csv b/examples/exports/v3.2/netbox_extras_custom fields.csv new file mode 100644 index 000000000..e084ade2b --- /dev/null +++ b/examples/exports/v3.2/netbox_extras_custom fields.csv @@ -0,0 +1,11 @@ +name,content_types,label,type,required,description,weight,default,filter_logic,choices,object_type +cf_boolean,"virtualization.virtualmachine,tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,ipam.vlan,ipam.service,ipam.iprange","Boolean field",boolean,False,,100,,loose,, +cf_date,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,date,False,,100,,loose,, +cf_integer,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,integer,False,,100,,loose,, +cf_multi_selection,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,multiselect,False,,100,,loose,"0,1", +cf_selection,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,select,False,,100,,loose,"0,1", +cf_text,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,text,False,,100,,loose,, +cf_url,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,url,False,,100,,loose,, +cf_json,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,json,False,,100,,loose,, +cf_multi_object,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,multiobject,False,,100,,loose,,dcim.platform +cf_object,"tenancy.tenant,tenancy.contactrole,tenancy.contactgroup,ipam.aggregate,ipam.ipaddress,ipam.prefix,tenancy.contact,virtualization.virtualmachine,ipam.vlan,ipam.service,ipam.iprange",,multiobject,False,,100,,loose,,dcim.platform diff --git a/examples/exports/v3.2/netbox_extras_tags.csv b/examples/exports/v3.2/netbox_extras_tags.csv new file mode 100644 index 000000000..79a1b120f --- /dev/null +++ b/examples/exports/v3.2/netbox_extras_tags.csv @@ -0,0 +1,3 @@ +name,slug,color,description +tag1,tag1,9e9e9e, +tag2,tag2,9e9e9e, diff --git a/examples/exports/v3.2/netbox_ipam_RIRs.csv b/examples/exports/v3.2/netbox_ipam_RIRs.csv new file mode 100644 index 000000000..eaef794ac --- /dev/null +++ b/examples/exports/v3.2/netbox_ipam_RIRs.csv @@ -0,0 +1,2 @@ +name,is_private,description,slug +test,False,"Test RIR",test diff --git a/examples/exports/v3.2/netbox_ipam_roles.csv b/examples/exports/v3.2/netbox_ipam_roles.csv new file mode 100644 index 000000000..ff32ea066 --- /dev/null +++ b/examples/exports/v3.2/netbox_ipam_roles.csv @@ -0,0 +1,3 @@ +name,description,slug,weight +backup,,backup,1000 +production,,production,1000 diff --git a/examples/exports/v3.2/netbox_platforms.csv b/examples/exports/v3.2/netbox_platforms.csv deleted file mode 100644 index 33ffdc546..000000000 --- a/examples/exports/v3.2/netbox_platforms.csv +++ /dev/null @@ -1,2 +0,0 @@ -Name,Manufacturer,Devices,VMs,NAPALM driver,Description,ID,Slug,NAPALM arguments,Tags,Created,Last updated -Debian_10,,0,0,,,1,Debian_10,,,2022-09-24 13:50,2022-09-24 13:50 diff --git a/examples/exports/v3.2/netbox_roles.csv b/examples/exports/v3.2/netbox_roles.csv deleted file mode 100644 index f020fda22..000000000 --- a/examples/exports/v3.2/netbox_roles.csv +++ /dev/null @@ -1,3 +0,0 @@ -Name,Prefixes,IP Ranges,VLANs,Description,ID,Slug,Weight,Tags,Created,Last updated -backup,0,0,0,,2,backup,1000,,2022-09-24 13:49,2022-09-24 13:49 -production,0,0,0,,1,production,1000,,2022-09-24 13:49,2022-09-24 13:49 diff --git a/examples/exports/v3.2/netbox_sites.csv b/examples/exports/v3.2/netbox_sites.csv deleted file mode 100644 index 43123854f..000000000 --- a/examples/exports/v3.2/netbox_sites.csv +++ /dev/null @@ -1,2 +0,0 @@ -Name,Status,Facility,Region,Group,Tenant,Description,ID,Slug,Tenant Group,ASNs,ASN Count,Time zone,Physical address,Shipping address,Latitude,Longitude,Comments,Contacts,Tags,Created,Last updated -pa3,Active,,,,,,1,pa3,,,0,,,,,,,,,2022-09-24 13:48,2022-09-24 13:48 diff --git a/examples/exports/v3.2/netbox_tags.csv b/examples/exports/v3.2/netbox_tags.csv deleted file mode 100644 index 7e70ecbf4..000000000 --- a/examples/exports/v3.2/netbox_tags.csv +++ /dev/null @@ -1,3 +0,0 @@ -Name,Items,Slug,Color,Description,ID,Created,Last updated -tag1,0,tag1,#9e9e9e,,1,2022-09-24 13:51,2022-09-24 13:51 -tag2,0,tag2,#9e9e9e,,2,2022-09-24 13:51,2022-09-24 13:51 diff --git a/examples/exports/v3.2/netbox_virtualization_cluster types.csv b/examples/exports/v3.2/netbox_virtualization_cluster types.csv new file mode 100644 index 000000000..62b980014 --- /dev/null +++ b/examples/exports/v3.2/netbox_virtualization_cluster types.csv @@ -0,0 +1,2 @@ +name,description,slug +test,"Test Cluster Type",test diff --git a/examples/exports/v3.2/netbox_virtualization_clusters.csv b/examples/exports/v3.2/netbox_virtualization_clusters.csv new file mode 100644 index 000000000..7f4be1c11 --- /dev/null +++ b/examples/exports/v3.2/netbox_virtualization_clusters.csv @@ -0,0 +1,2 @@ +name,type +test,test