From a42dbb8d41eada1a841e3a5bed10ce60d0266399 Mon Sep 17 00:00:00 2001 From: holmesb <5072156+holmesb@users.noreply.github.com> Date: Fri, 7 Jan 2022 15:54:18 +0000 Subject: [PATCH] Resource netbox_available_ip_address: fixed duplicates (#59) and can now be created in netbox_ip_ranges (#105) --- CHANGELOG.md | 8 ++ go.mod | 11 +- go.sum | 23 +++- netbox/client.go | 2 +- netbox/data_source_netbox_cluster.go | 4 +- netbox/data_source_netbox_cluster_group.go | 4 +- netbox/data_source_netbox_device_role.go | 4 +- netbox/data_source_netbox_interfaces.go | 6 +- netbox/data_source_netbox_ip_range.go | 4 +- netbox/data_source_netbox_platform.go | 4 +- netbox/data_source_netbox_prefix.go | 4 +- netbox/data_source_netbox_tag.go | 4 +- netbox/data_source_netbox_tenant.go | 4 +- netbox/data_source_netbox_tenant_group.go | 4 +- netbox/data_source_netbox_virtual_machines.go | 6 +- netbox/data_source_netbox_vrf.go | 4 +- netbox/netbox_sweeper_test.go | 2 +- netbox/provider.go | 4 +- .../resource_netbox_available_ip_address.go | 89 +++++++------- ...source_netbox_available_ip_address_test.go | 112 +++++++++++++++++- netbox/resource_netbox_available_prefix.go | 6 +- .../resource_netbox_available_prefix_test.go | 6 +- netbox/resource_netbox_cluster.go | 6 +- netbox/resource_netbox_cluster_group.go | 6 +- netbox/resource_netbox_cluster_group_test.go | 4 +- netbox/resource_netbox_cluster_test.go | 4 +- netbox/resource_netbox_cluster_type.go | 6 +- netbox/resource_netbox_cluster_type_test.go | 4 +- netbox/resource_netbox_device_role.go | 6 +- netbox/resource_netbox_device_role_test.go | 4 +- netbox/resource_netbox_interface.go | 6 +- netbox/resource_netbox_interface_test.go | 4 +- netbox/resource_netbox_ip_address.go | 8 +- netbox/resource_netbox_ip_address_test.go | 6 +- netbox/resource_netbox_ip_range.go | 6 +- netbox/resource_netbox_ip_range_test.go | 4 +- netbox/resource_netbox_ipam_role.go | 6 +- netbox/resource_netbox_ipam_role_test.go | 4 +- netbox/resource_netbox_platform.go | 6 +- netbox/resource_netbox_platform_test.go | 4 +- netbox/resource_netbox_prefix.go | 6 +- netbox/resource_netbox_prefix_test.go | 6 +- netbox/resource_netbox_primary_ip.go | 6 +- netbox/resource_netbox_service.go | 6 +- netbox/resource_netbox_service_test.go | 4 +- netbox/resource_netbox_site.go | 6 +- netbox/resource_netbox_site_test.go | 4 +- netbox/resource_netbox_tag.go | 6 +- netbox/resource_netbox_tag_test.go | 4 +- netbox/resource_netbox_tenant.go | 6 +- netbox/resource_netbox_tenant_group.go | 6 +- netbox/resource_netbox_tenant_group_test.go | 4 +- netbox/resource_netbox_tenant_test.go | 4 +- netbox/resource_netbox_virtual_machine.go | 6 +- .../resource_netbox_virtual_machine_test.go | 4 +- netbox/resource_netbox_vlan.go | 6 +- netbox/resource_netbox_vlan_test.go | 4 +- netbox/resource_netbox_vrf.go | 6 +- netbox/resource_netbox_vrf_test.go | 4 +- netbox/tags.go | 6 +- netbox/tags_test.go | 2 +- website/docs/r/available_ip_address.md | 40 ++++--- 62 files changed, 341 insertions(+), 214 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84a29b37..b301e528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.2.0 (Jan 7, 2022) + +FEATURES + +* resource `netbox_available_ip_address`: fixed duplicates ([#59](https://github.com/e-breuninger/terraform-provider-netbox/issues/59) by [@holmesb](https://github.com/holmesb)) +* resource `netbox_available_ip_address`: can now be created in netbox_ip_ranges ([#105](https://github.com/e-breuninger/terraform-provider-netbox/issues/105) by [@holmesb](https://github.com/holmesb)) +* resource `netbox_available_ip_address`: added `description` argument + ## 1.1.0 (Jan 3, 2022) FEATURES diff --git a/go.mod b/go.mod index c7dc98bd..2152aa6f 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.17 require ( github.com/davecgh/go-spew v1.1.1 - github.com/fbreckle/go-netbox v0.0.0-20211223172728-2da47c1929a7 github.com/go-openapi/runtime v0.19.32-0.20210924162202-f7fb72beda3a github.com/goware/urlx v0.3.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1 + github.com/holmesb/go-netbox v0.0.1 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 ) @@ -22,13 +22,13 @@ require ( github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect github.com/fatih/color v1.7.0 // indirect github.com/go-openapi/analysis v0.20.0 // indirect - github.com/go-openapi/errors v0.19.9 // indirect + github.com/go-openapi/errors v0.20.1 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.19.5 // indirect github.com/go-openapi/loads v0.20.2 // indirect github.com/go-openapi/spec v0.20.3 // indirect - github.com/go-openapi/strfmt v0.20.0 // indirect - github.com/go-openapi/swag v0.19.14 // indirect + github.com/go-openapi/strfmt v0.20.2 // indirect + github.com/go-openapi/swag v0.19.15 // indirect github.com/go-openapi/validate v0.20.2 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/golang/protobuf v1.4.2 // indirect @@ -62,11 +62,12 @@ require ( github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.0.0 // indirect + github.com/oklog/ulid v1.3.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/zclconf/go-cty v1.9.1 // indirect - go.mongodb.org/mongo-driver v1.4.6 // indirect + go.mongodb.org/mongo-driver v1.5.1 // indirect golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect golang.org/x/net v0.0.0-20210326060303-6b1517762897 // indirect golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect diff --git a/go.sum b/go.sum index 4176ee44..1c2b9136 100644 --- a/go.sum +++ b/go.sum @@ -102,8 +102,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fbreckle/go-netbox v0.0.0-20211223172728-2da47c1929a7 h1:21foc44CmZKU+6BzkaWZBLjd8t5/Z9q//AF/r9rwRrY= -github.com/fbreckle/go-netbox v0.0.0-20211223172728-2da47c1929a7/go.mod h1:Nf2bxylehF4ROF+s2paaRCKLIeYcUb2+NK1R/nOsE0o= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= @@ -136,8 +134,9 @@ github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.19.9 h1:9SnKdGhiPZHF3ttwFMiCBEb8jQ4IDdrK+5+a0oTygA4= github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.1 h1:j23mMDtRxMwIobkpId7sWh7Ddcx4ivaoqUbfXx5P+a8= +github.com/go-openapi/errors v0.20.1/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -189,8 +188,9 @@ github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6 github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= -github.com/go-openapi/strfmt v0.20.0 h1:l2omNtmNbMc39IGptl9BuXBEKcZfS8zjrTsPKTiJiDM= github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= +github.com/go-openapi/strfmt v0.20.2 h1:6XZL+fF4VZYFxKQGLAUB358hOrRh/wS51uWEtlONADE= +github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -199,8 +199,9 @@ github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfT github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= @@ -353,6 +354,8 @@ github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/holmesb/go-netbox v0.0.1 h1:JB49Uaaq3sxfDsqPH1x87Aj+EnWnZa/0MZWL2lN13L4= +github.com/holmesb/go-netbox v0.0.1/go.mod h1:wJ3nb2D8C4geo9Nndk+HEZVHIz502qlrENgt8WzSJNo= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= @@ -445,6 +448,8 @@ github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= @@ -494,8 +499,12 @@ github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+ github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -510,8 +519,9 @@ go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -go.mongodb.org/mongo-driver v1.4.6 h1:rh7GdYmDrb8AQSkF8yteAus8qYOgOASWDOv1BWqBXkU= go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.5.1 h1:9nOVLGDfOaZ9R0tBumx/BcuqkbFpyTCU2r/Po7A2azI= +go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -530,6 +540,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= diff --git a/netbox/client.go b/netbox/client.go index 2b07b737..0359a28e 100644 --- a/netbox/client.go +++ b/netbox/client.go @@ -3,9 +3,9 @@ package netbox import ( "fmt" - netboxclient "github.com/fbreckle/go-netbox/netbox/client" httptransport "github.com/go-openapi/runtime/client" "github.com/goware/urlx" + netboxclient "github.com/holmesb/go-netbox/netbox/client" log "github.com/sirupsen/logrus" ) diff --git a/netbox/data_source_netbox_cluster.go b/netbox/data_source_netbox_cluster.go index b8c17d73..cdb57cfa 100644 --- a/netbox/data_source_netbox_cluster.go +++ b/netbox/data_source_netbox_cluster.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" ) func dataSourceNetboxCluster() *schema.Resource { diff --git a/netbox/data_source_netbox_cluster_group.go b/netbox/data_source_netbox_cluster_group.go index abd34e64..6adeba23 100644 --- a/netbox/data_source_netbox_cluster_group.go +++ b/netbox/data_source_netbox_cluster_group.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" ) func dataSourceNetboxClusterGroup() *schema.Resource { diff --git a/netbox/data_source_netbox_device_role.go b/netbox/data_source_netbox_device_role.go index c72ec311..ff237727 100644 --- a/netbox/data_source_netbox_device_role.go +++ b/netbox/data_source_netbox_device_role.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" ) func dataSourceNetboxDeviceRole() *schema.Resource { diff --git a/netbox/data_source_netbox_interfaces.go b/netbox/data_source_netbox_interfaces.go index 5bcc4432..a0e5e0fe 100644 --- a/netbox/data_source_netbox_interfaces.go +++ b/netbox/data_source_netbox_interfaces.go @@ -5,12 +5,12 @@ import ( "fmt" "regexp" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func dataSourceNetboxInterfaces() *schema.Resource { diff --git a/netbox/data_source_netbox_ip_range.go b/netbox/data_source_netbox_ip_range.go index fe870aef..3b884b66 100644 --- a/netbox/data_source_netbox_ip_range.go +++ b/netbox/data_source_netbox_ip_range.go @@ -4,10 +4,10 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func dataSourceNetboxIpRange() *schema.Resource { diff --git a/netbox/data_source_netbox_platform.go b/netbox/data_source_netbox_platform.go index db02aa34..1fb21b07 100644 --- a/netbox/data_source_netbox_platform.go +++ b/netbox/data_source_netbox_platform.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" ) func dataSourceNetboxPlatform() *schema.Resource { diff --git a/netbox/data_source_netbox_prefix.go b/netbox/data_source_netbox_prefix.go index 6f1fc857..609c0034 100644 --- a/netbox/data_source_netbox_prefix.go +++ b/netbox/data_source_netbox_prefix.go @@ -4,10 +4,10 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func dataSourceNetboxPrefix() *schema.Resource { diff --git a/netbox/data_source_netbox_tag.go b/netbox/data_source_netbox_tag.go index 6250bee0..7e2f0b8f 100644 --- a/netbox/data_source_netbox_tag.go +++ b/netbox/data_source_netbox_tag.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/extras" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/extras" ) func dataSourceNetboxTag() *schema.Resource { diff --git a/netbox/data_source_netbox_tenant.go b/netbox/data_source_netbox_tenant.go index b2dc652d..443fe681 100644 --- a/netbox/data_source_netbox_tenant.go +++ b/netbox/data_source_netbox_tenant.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/tenancy" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/tenancy" ) func dataSourceNetboxTenant() *schema.Resource { diff --git a/netbox/data_source_netbox_tenant_group.go b/netbox/data_source_netbox_tenant_group.go index a9d2343d..4893b46c 100644 --- a/netbox/data_source_netbox_tenant_group.go +++ b/netbox/data_source_netbox_tenant_group.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/tenancy" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/tenancy" ) func dataSourceNetboxTenantGroup() *schema.Resource { diff --git a/netbox/data_source_netbox_virtual_machines.go b/netbox/data_source_netbox_virtual_machines.go index a7e02147..16e98630 100644 --- a/netbox/data_source_netbox_virtual_machines.go +++ b/netbox/data_source_netbox_virtual_machines.go @@ -6,12 +6,12 @@ import ( "fmt" "regexp" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func dataSourceNetboxVirtualMachine() *schema.Resource { diff --git a/netbox/data_source_netbox_vrf.go b/netbox/data_source_netbox_vrf.go index e9879505..7880a350 100644 --- a/netbox/data_source_netbox_vrf.go +++ b/netbox/data_source_netbox_vrf.go @@ -4,9 +4,9 @@ import ( "errors" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func dataSourceNetboxVrf() *schema.Resource { diff --git a/netbox/netbox_sweeper_test.go b/netbox/netbox_sweeper_test.go index 2dd7850f..22d2b3ff 100644 --- a/netbox/netbox_sweeper_test.go +++ b/netbox/netbox_sweeper_test.go @@ -4,9 +4,9 @@ import ( "os" "testing" - "github.com/fbreckle/go-netbox/netbox/client" httptransport "github.com/go-openapi/runtime/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" ) // sweeperNetboxClients is a shared cache of netbox clients diff --git a/netbox/provider.go b/netbox/provider.go index 93c102a8..86970220 100644 --- a/netbox/provider.go +++ b/netbox/provider.go @@ -4,10 +4,10 @@ import ( "context" "fmt" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/status" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/status" ) // Provider returns a schema.Provider for Netbox. diff --git a/netbox/resource_netbox_available_ip_address.go b/netbox/resource_netbox_available_ip_address.go index 5b0196bd..e45a56b8 100644 --- a/netbox/resource_netbox_available_ip_address.go +++ b/netbox/resource_netbox_available_ip_address.go @@ -1,16 +1,12 @@ package netbox import ( - "context" - "errors" - "fmt" - "strconv" - - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" + "strconv" ) func resourceNetboxAvailableIPAddress() *schema.Resource { @@ -22,8 +18,13 @@ func resourceNetboxAvailableIPAddress() *schema.Resource { Schema: map[string]*schema.Schema{ "prefix_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + ExactlyOneOf: []string{"prefix_id", "ip_range_id"}, + }, + "ip_range_id": &schema.Schema{ Type: schema.TypeInt, - Required: true, + Optional: true, }, "ip_address": &schema.Schema{ Type: schema.TypeString, @@ -44,12 +45,16 @@ func resourceNetboxAvailableIPAddress() *schema.Resource { "status": &schema.Schema{ Type: schema.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{"active", "reserved", "deprecated", "dhcp"}, false), + ValidateFunc: validation.StringInSlice([]string{"active", "reserved", "deprecated", "dhcp", "slaac"}, false), }, "dns_name": { Type: schema.TypeString, Optional: true, }, + "description": { + Type: schema.TypeString, + Optional: true, + }, "tags": &schema.Schema{ Type: schema.TypeSet, Elem: &schema.Schema{ @@ -66,44 +71,30 @@ func resourceNetboxAvailableIPAddress() *schema.Resource { } func resourceNetboxAvailableIPAddressCreate(d *schema.ResourceData, m interface{}) error { - api := m.(*client.NetBoxAPI) - prefix_id := int64(d.Get("prefix_id").(int)) - - // Get all the available IPs from the given prefix - ipsread := &ipam.IpamPrefixesAvailableIpsReadParams{ - ID: prefix_id, - Context: context.Background(), - } - - resp, err := api.Ipam.IpamPrefixesAvailableIpsRead(ipsread, nil) - - if err != nil { - return errors.New(fmt.Sprintf("Problem getting IPs from prefix %d: %v", prefix_id, err)) + prefixId := int64(d.Get("prefix_id").(int)) + vrfId := int64(int64(d.Get("vrf_id").(int))) + rangeId := int64(d.Get("ip_range_id").(int)) + nestedvrf := models.NestedVRF{ + ID: vrfId, + } + data := models.AvailableIP{ + Vrf: &nestedvrf, + } + if prefixId != 0 { + params := ipam.NewIpamPrefixesAvailableIpsCreateParams().WithID(prefixId).WithData([]*models.AvailableIP{&data}) + res, _ := api.Ipam.IpamPrefixesAvailableIpsCreate(params, nil) + // Since we generated the ip_address set that now + d.SetId(strconv.FormatInt(res.Payload[0].ID, 10)) + d.Set("ip_address", *res.Payload[0].Address) + } + if rangeId != 0 { + params := ipam.NewIpamIPRangesAvailableIpsCreateParams().WithID(rangeId).WithData([]*models.AvailableIP{&data}) + res, _ := api.Ipam.IpamIPRangesAvailableIpsCreate(params, nil) + // Since we generated the ip_address set that now + d.SetId(strconv.FormatInt(res.Payload[0].ID, 10)) + d.Set("ip_address", *res.Payload[0].Address) } - - data := models.WritableIPAddress{} - // Use the first Payload Address as our data.Address value - data.Address = &resp.Payload[0].Address - data.Status = d.Get("status").(string) - - if dnsName, ok := d.GetOk("dns_name"); ok { - data.DNSName = dnsName.(string) - } - - data.Tags, _ = getNestedTagListFromResourceDataSet(api, d.Get("tags")) - - params := ipam.NewIpamIPAddressesCreateParams().WithData(&data) - - res, err := api.Ipam.IpamIPAddressesCreate(params, nil) - if err != nil { - return err - } - - // Since we generated the ip_address set that now - d.Set("ip_address", res.Payload.Address) - d.SetId(strconv.FormatInt(res.GetPayload().ID, 10)) - return resourceNetboxAvailableIPAddressUpdate(d, m) } @@ -125,7 +116,7 @@ func resourceNetboxAvailableIPAddressRead(d *schema.ResourceData, m interface{}) } if res.GetPayload().AssignedObject != nil { - d.Set("interface_id", res.GetPayload().AssignedObject.ID) + d.Set("interface_id", res.GetPayload().AssignedObjectID) } else { d.Set("interface_id", nil) } @@ -147,6 +138,7 @@ func resourceNetboxAvailableIPAddressRead(d *schema.ResourceData, m interface{}) } d.Set("ip_address", res.GetPayload().Address) + d.Set("description", res.GetPayload().Description) d.Set("status", res.GetPayload().Status.Value) d.Set("tags", getTagListFromNestedTagList(res.GetPayload().Tags)) return nil @@ -161,8 +153,10 @@ func resourceNetboxAvailableIPAddressUpdate(d *schema.ResourceData, m interface{ ipAddress := d.Get("ip_address").(string) status := d.Get("status").(string) + description := d.Get("description").(string) data.Status = status + data.Description = description data.Address = &ipAddress if d.HasChange("dns_name") { @@ -196,7 +190,6 @@ func resourceNetboxAvailableIPAddressUpdate(d *schema.ResourceData, m interface{ if err != nil { return err } - return resourceNetboxAvailableIPAddressRead(d, m) } diff --git a/netbox/resource_netbox_available_ip_address_test.go b/netbox/resource_netbox_available_ip_address_test.go index 02838f24..26b01ee7 100644 --- a/netbox/resource_netbox_available_ip_address_test.go +++ b/netbox/resource_netbox_available_ip_address_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func TestAccNetboxAvailableIPAddress_basic(t *testing.T) { @@ -39,6 +39,33 @@ resource "netbox_available_ip_address" "test" { }, }) } +func TestAccNetboxAvailableIPAddress_basic_range(t *testing.T) { + startAddress := "1.1.5.1/24" + endAddress := "1.1.5.50/24" + testIP := "1.1.5.1/24" + resource.ParallelTest(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf(` +resource "netbox_ip_range" "test" { + start_address = "%s" + end_address = "%s" +} +resource "netbox_available_ip_address" "test_range" { + ip_range_id = netbox_ip_range.test.id + status = "active" + dns_name = "test_range.mydomain.local" +}`, startAddress, endAddress), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("netbox_available_ip_address.test_range", "ip_address", testIP), + resource.TestCheckResourceAttr("netbox_available_ip_address.test_range", "status", "active"), + resource.TestCheckResourceAttr("netbox_available_ip_address.test_range", "dns_name", "test_range.mydomain.local"), + ), + }, + }, + }) +} func TestAccNetboxAvailableIPAddress_multipleIpsParallel(t *testing.T) { testPrefix := "1.1.3.0/24" @@ -79,6 +106,45 @@ resource "netbox_available_ip_address" "test3" { }) } +func TestAccNetboxAvailableIPAddress_multipleIpsParallel_range(t *testing.T) { + startAddress := "1.1.6.1/24" + endAddress := "1.1.6.50/24" + testIP := []string{"1.1.6.1/24", "1.1.6.2/24", "1.1.6.3/24"} + resource.ParallelTest(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf(` +resource "netbox_ip_range" "test_range" { + start_address = "%s" + end_address = "%s" +} +resource "netbox_available_ip_address" "test_range1" { + ip_range_id = test_range.test_range.id + status = "active" + dns_name = "test_range.mydomain.local" +} +resource "netbox_available_ip_address" "test_range2" { + ip_range_id = test_range.test_range.id + status = "active" + dns_name = "test_range.mydomain.local" +} +resource "netbox_available_ip_address" "test_range3" { + ip_range_id = test_range.test_range.id + status = "active" + dns_name = "test_range.mydomain.local" +}`, startAddress, endAddress), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("netbox_available_ip_address.test1", "ip_address", testIP[0]), + resource.TestCheckResourceAttr("netbox_available_ip_address.test2", "ip_address", testIP[1]), + resource.TestCheckResourceAttr("netbox_available_ip_address.test3", "ip_address", testIP[2]), + ), + ExpectError: regexp.MustCompile(".*"), + }, + }, + }) +} + func TestAccNetboxAvailableIPAddress_multipleIpsSerial(t *testing.T) { testPrefix := "1.1.4.0/24" testIP := []string{"1.1.4.1/24", "1.1.4.2/24", "1.1.4.3/24"} @@ -119,6 +185,46 @@ resource "netbox_available_ip_address" "test3" { }) } +func TestAccNetboxAvailableIPAddress_multipleIpsSerial_range(t *testing.T) { + startAddress := "1.1.7.1/24" + endAddress := "1.1.7.50/24" + testIP := []string{"1.1.7.1/24", "1.1.7.2/24", "1.1.7.3/24"} + resource.ParallelTest(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf(` +resource "netbox_ip_range" "test_range" { + start_address = "%s" + end_address = "%s" +} +resource "netbox_available_ip_address" "test_range1" { + ip_range_id = netbox_ip_range.test_range.id + status = "active" + dns_name = "test_range.mydomain.local" +} +resource "netbox_available_ip_address" "test_range2" { + depends_on = [netbox_available_ip_address.test_range1] + ip_range_id = netbox_ip_range.test_range.id + status = "active" + dns_name = "test_range.mydomain.local" +} +resource "netbox_available_ip_address" "test_range3" { + depends_on = [netbox_available_ip_address.test_range2] + ip_range_id = netbox_ip_range.test_range.id + status = "active" + dns_name = "test_range.mydomain.local" +}`, startAddress, endAddress), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("netbox_available_ip_address.test_range1", "ip_address", testIP[0]), + resource.TestCheckResourceAttr("netbox_available_ip_address.test_range2", "ip_address", testIP[1]), + resource.TestCheckResourceAttr("netbox_available_ip_address.test_range3", "ip_address", testIP[2]), + ), + }, + }, + }) +} + func init() { resource.AddTestSweepers("netbox_available_ip_address", &resource.Sweeper{ Name: "netbox_available_ip_address", diff --git a/netbox/resource_netbox_available_prefix.go b/netbox/resource_netbox_available_prefix.go index f47e8fb5..f9e55032 100644 --- a/netbox/resource_netbox_available_prefix.go +++ b/netbox/resource_netbox_available_prefix.go @@ -6,11 +6,11 @@ import ( "strconv" "strings" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxAvailablePrefix() *schema.Resource { diff --git a/netbox/resource_netbox_available_prefix_test.go b/netbox/resource_netbox_available_prefix_test.go index b98a3305..2c75c512 100644 --- a/netbox/resource_netbox_available_prefix_test.go +++ b/netbox/resource_netbox_available_prefix_test.go @@ -5,11 +5,11 @@ import ( "regexp" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" log "github.com/sirupsen/logrus" ) diff --git a/netbox/resource_netbox_cluster.go b/netbox/resource_netbox_cluster.go index edc6de1f..7eeb9b3f 100644 --- a/netbox/resource_netbox_cluster.go +++ b/netbox/resource_netbox_cluster.go @@ -3,10 +3,10 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxCluster() *schema.Resource { diff --git a/netbox/resource_netbox_cluster_group.go b/netbox/resource_netbox_cluster_group.go index 00933eda..486363e6 100644 --- a/netbox/resource_netbox_cluster_group.go +++ b/netbox/resource_netbox_cluster_group.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxClusterGroup() *schema.Resource { diff --git a/netbox/resource_netbox_cluster_group_test.go b/netbox/resource_netbox_cluster_group_test.go index d0bcc812..6f38ac6a 100644 --- a/netbox/resource_netbox_cluster_group_test.go +++ b/netbox/resource_netbox_cluster_group_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" ) func TestAccNetboxClusterGroup_basic(t *testing.T) { diff --git a/netbox/resource_netbox_cluster_test.go b/netbox/resource_netbox_cluster_test.go index 2fc20ff2..cf47317d 100644 --- a/netbox/resource_netbox_cluster_test.go +++ b/netbox/resource_netbox_cluster_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" ) func TestAccNetboxCluster_basic(t *testing.T) { diff --git a/netbox/resource_netbox_cluster_type.go b/netbox/resource_netbox_cluster_type.go index abaf676f..2837f6da 100644 --- a/netbox/resource_netbox_cluster_type.go +++ b/netbox/resource_netbox_cluster_type.go @@ -3,10 +3,10 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxClusterType() *schema.Resource { diff --git a/netbox/resource_netbox_cluster_type_test.go b/netbox/resource_netbox_cluster_type_test.go index 5accfe15..21bc679f 100644 --- a/netbox/resource_netbox_cluster_type_test.go +++ b/netbox/resource_netbox_cluster_type_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" ) func TestAccNetboxClusterType_basic(t *testing.T) { diff --git a/netbox/resource_netbox_device_role.go b/netbox/resource_netbox_device_role.go index 35b4cd65..f4f2da6d 100644 --- a/netbox/resource_netbox_device_role.go +++ b/netbox/resource_netbox_device_role.go @@ -3,10 +3,10 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxDeviceRole() *schema.Resource { diff --git a/netbox/resource_netbox_device_role_test.go b/netbox/resource_netbox_device_role_test.go index 9b2e4834..22c82292 100644 --- a/netbox/resource_netbox_device_role_test.go +++ b/netbox/resource_netbox_device_role_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" ) func TestAccNetboxDeviceRole_basic(t *testing.T) { diff --git a/netbox/resource_netbox_interface.go b/netbox/resource_netbox_interface.go index c42b81ea..eabc10f1 100644 --- a/netbox/resource_netbox_interface.go +++ b/netbox/resource_netbox_interface.go @@ -4,11 +4,11 @@ import ( "regexp" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxInterface() *schema.Resource { diff --git a/netbox/resource_netbox_interface_test.go b/netbox/resource_netbox_interface_test.go index fa7cd8a8..d76f9234 100644 --- a/netbox/resource_netbox_interface_test.go +++ b/netbox/resource_netbox_interface_test.go @@ -6,10 +6,10 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" log "github.com/sirupsen/logrus" ) diff --git a/netbox/resource_netbox_ip_address.go b/netbox/resource_netbox_ip_address.go index caa3dd0c..a15f253c 100644 --- a/netbox/resource_netbox_ip_address.go +++ b/netbox/resource_netbox_ip_address.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxIPAddress() *schema.Resource { @@ -103,7 +103,7 @@ func resourceNetboxIPAddressRead(d *schema.ResourceData, m interface{}) error { } if res.GetPayload().AssignedObject != nil { - d.Set("interface_id", res.GetPayload().AssignedObject.ID) + d.Set("interface_id", res.GetPayload().AssignedObjectID) } else { d.Set("interface_id", nil) } diff --git a/netbox/resource_netbox_ip_address_test.go b/netbox/resource_netbox_ip_address_test.go index 537e9bcb..f540c604 100644 --- a/netbox/resource_netbox_ip_address_test.go +++ b/netbox/resource_netbox_ip_address_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func testAccNetboxIPAddressFullDependencies(testName string) string { diff --git a/netbox/resource_netbox_ip_range.go b/netbox/resource_netbox_ip_range.go index aa089312..40d4c096 100644 --- a/netbox/resource_netbox_ip_range.go +++ b/netbox/resource_netbox_ip_range.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxIpRange() *schema.Resource { diff --git a/netbox/resource_netbox_ip_range_test.go b/netbox/resource_netbox_ip_range_test.go index 9379d934..ab48f289 100644 --- a/netbox/resource_netbox_ip_range_test.go +++ b/netbox/resource_netbox_ip_range_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func testAccNetboxIpRangeFullDependencies(testStartAddress string, testSlug string) string { diff --git a/netbox/resource_netbox_ipam_role.go b/netbox/resource_netbox_ipam_role.go index 8c3af49d..c0d501ae 100644 --- a/netbox/resource_netbox_ipam_role.go +++ b/netbox/resource_netbox_ipam_role.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxIpamRole() *schema.Resource { diff --git a/netbox/resource_netbox_ipam_role_test.go b/netbox/resource_netbox_ipam_role_test.go index c3a2fd7a..aaa6d751 100644 --- a/netbox/resource_netbox_ipam_role_test.go +++ b/netbox/resource_netbox_ipam_role_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func TestAccNetboxRole_basic(t *testing.T) { diff --git a/netbox/resource_netbox_platform.go b/netbox/resource_netbox_platform.go index 3a2be68f..87e5d4ae 100644 --- a/netbox/resource_netbox_platform.go +++ b/netbox/resource_netbox_platform.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxPlatform() *schema.Resource { diff --git a/netbox/resource_netbox_platform_test.go b/netbox/resource_netbox_platform_test.go index fa75999d..bd7fc6f5 100644 --- a/netbox/resource_netbox_platform_test.go +++ b/netbox/resource_netbox_platform_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" ) func TestAccNetboxPlatform_basic(t *testing.T) { diff --git a/netbox/resource_netbox_prefix.go b/netbox/resource_netbox_prefix.go index 35d04244..599bf863 100644 --- a/netbox/resource_netbox_prefix.go +++ b/netbox/resource_netbox_prefix.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxPrefix() *schema.Resource { diff --git a/netbox/resource_netbox_prefix_test.go b/netbox/resource_netbox_prefix_test.go index 3c4c50a3..10f72ebd 100644 --- a/netbox/resource_netbox_prefix_test.go +++ b/netbox/resource_netbox_prefix_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func testAccNetboxPrefixFullDependencies(testName string, testSlug string, testVid string) string { diff --git a/netbox/resource_netbox_primary_ip.go b/netbox/resource_netbox_primary_ip.go index 3b4575a9..d779f9e0 100644 --- a/netbox/resource_netbox_primary_ip.go +++ b/netbox/resource_netbox_primary_ip.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxPrimaryIP() *schema.Resource { diff --git a/netbox/resource_netbox_service.go b/netbox/resource_netbox_service.go index e3815d63..a904c8f9 100644 --- a/netbox/resource_netbox_service.go +++ b/netbox/resource_netbox_service.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxService() *schema.Resource { diff --git a/netbox/resource_netbox_service_test.go b/netbox/resource_netbox_service_test.go index db68ec22..755ef5d8 100644 --- a/netbox/resource_netbox_service_test.go +++ b/netbox/resource_netbox_service_test.go @@ -7,10 +7,10 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func testAccNetboxServiceFullDependencies(testName string) string { diff --git a/netbox/resource_netbox_site.go b/netbox/resource_netbox_site.go index 2f03fc07..e12139b9 100644 --- a/netbox/resource_netbox_site.go +++ b/netbox/resource_netbox_site.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxSite() *schema.Resource { diff --git a/netbox/resource_netbox_site_test.go b/netbox/resource_netbox_site_test.go index 33307dee..625a9d84 100644 --- a/netbox/resource_netbox_site_test.go +++ b/netbox/resource_netbox_site_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/dcim" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/dcim" ) func TestAccNetboxSite_basic(t *testing.T) { diff --git a/netbox/resource_netbox_tag.go b/netbox/resource_netbox_tag.go index 7ff524c0..e8483a31 100644 --- a/netbox/resource_netbox_tag.go +++ b/netbox/resource_netbox_tag.go @@ -4,11 +4,11 @@ import ( "regexp" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/extras" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/extras" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxTag() *schema.Resource { diff --git a/netbox/resource_netbox_tag_test.go b/netbox/resource_netbox_tag_test.go index 3727808f..5f10d2ed 100644 --- a/netbox/resource_netbox_tag_test.go +++ b/netbox/resource_netbox_tag_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/extras" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/extras" ) func TestAccNetboxTag_basic(t *testing.T) { diff --git a/netbox/resource_netbox_tenant.go b/netbox/resource_netbox_tenant.go index 565fe908..ce9a7e28 100644 --- a/netbox/resource_netbox_tenant.go +++ b/netbox/resource_netbox_tenant.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/tenancy" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/tenancy" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxTenant() *schema.Resource { diff --git a/netbox/resource_netbox_tenant_group.go b/netbox/resource_netbox_tenant_group.go index 0f860515..ba43e758 100644 --- a/netbox/resource_netbox_tenant_group.go +++ b/netbox/resource_netbox_tenant_group.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/tenancy" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/tenancy" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxTenantGroup() *schema.Resource { diff --git a/netbox/resource_netbox_tenant_group_test.go b/netbox/resource_netbox_tenant_group_test.go index 7c17a75c..8e31b457 100644 --- a/netbox/resource_netbox_tenant_group_test.go +++ b/netbox/resource_netbox_tenant_group_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/tenancy" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/tenancy" ) func TestAccNetboxTenantGroup_basic(t *testing.T) { diff --git a/netbox/resource_netbox_tenant_test.go b/netbox/resource_netbox_tenant_test.go index 4dfd3a20..0a681d13 100644 --- a/netbox/resource_netbox_tenant_test.go +++ b/netbox/resource_netbox_tenant_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/tenancy" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/tenancy" ) func testAccNetboxTenantTagDependencies(testName string) string { diff --git a/netbox/resource_netbox_virtual_machine.go b/netbox/resource_netbox_virtual_machine.go index f3389f68..0f7964e9 100644 --- a/netbox/resource_netbox_virtual_machine.go +++ b/netbox/resource_netbox_virtual_machine.go @@ -4,11 +4,11 @@ import ( "context" "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxVirtualMachine() *schema.Resource { diff --git a/netbox/resource_netbox_virtual_machine_test.go b/netbox/resource_netbox_virtual_machine_test.go index c90bc99d..b27703dd 100644 --- a/netbox/resource_netbox_virtual_machine_test.go +++ b/netbox/resource_netbox_virtual_machine_test.go @@ -7,10 +7,10 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/virtualization" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/virtualization" ) func testAccNetboxVirtualMachineFullDependencies(testName string) string { diff --git a/netbox/resource_netbox_vlan.go b/netbox/resource_netbox_vlan.go index d1aee735..2b0a4148 100644 --- a/netbox/resource_netbox_vlan.go +++ b/netbox/resource_netbox_vlan.go @@ -3,11 +3,11 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxVlan() *schema.Resource { diff --git a/netbox/resource_netbox_vlan_test.go b/netbox/resource_netbox_vlan_test.go index 9b2295f7..fca95f67 100644 --- a/netbox/resource_netbox_vlan_test.go +++ b/netbox/resource_netbox_vlan_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func testAccNetboxVlanFullDependencies(testName string) string { diff --git a/netbox/resource_netbox_vrf.go b/netbox/resource_netbox_vrf.go index a1d05e61..66d79924 100644 --- a/netbox/resource_netbox_vrf.go +++ b/netbox/resource_netbox_vrf.go @@ -3,10 +3,10 @@ package netbox import ( "strconv" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" + "github.com/holmesb/go-netbox/netbox/models" ) func resourceNetboxVrf() *schema.Resource { diff --git a/netbox/resource_netbox_vrf_test.go b/netbox/resource_netbox_vrf_test.go index 35ed610f..93b88d8d 100644 --- a/netbox/resource_netbox_vrf_test.go +++ b/netbox/resource_netbox_vrf_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/ipam" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/ipam" ) func testAccNetboxVrfTagDependencies(testName string) string { diff --git a/netbox/tags.go b/netbox/tags.go index 3d64b148..f857e694 100644 --- a/netbox/tags.go +++ b/netbox/tags.go @@ -3,11 +3,11 @@ package netbox import ( "fmt" - "github.com/fbreckle/go-netbox/netbox/client" - "github.com/fbreckle/go-netbox/netbox/client/extras" - "github.com/fbreckle/go-netbox/netbox/models" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/holmesb/go-netbox/netbox/client" + "github.com/holmesb/go-netbox/netbox/client/extras" + "github.com/holmesb/go-netbox/netbox/models" ) func getNestedTagListFromResourceDataSet(client *client.NetBoxAPI, d interface{}) ([]*models.NestedTag, diag.Diagnostics) { diff --git a/netbox/tags_test.go b/netbox/tags_test.go index b0864eb8..53eb6c93 100644 --- a/netbox/tags_test.go +++ b/netbox/tags_test.go @@ -3,7 +3,7 @@ package netbox import ( "testing" - "github.com/fbreckle/go-netbox/netbox/models" + "github.com/holmesb/go-netbox/netbox/models" "github.com/stretchr/testify/assert" ) diff --git a/website/docs/r/available_ip_address.md b/website/docs/r/available_ip_address.md index c9584297..d687d228 100644 --- a/website/docs/r/available_ip_address.md +++ b/website/docs/r/available_ip_address.md @@ -21,20 +21,29 @@ Per [the docs](https://netbox.readthedocs.io/en/stable/models/ipam/ipaddress/): > - DHCP > - SLAAC (IPv6 Stateless Address Autoconfiguration) -This resource will retrieve the next available IP address from a given prefix (specified by ID) +This resource will retrieve the next available IP address from a given prefix or IP range (specified by ID) ## Example Usage -### Marking an IP reserved +### Creating an IP in a prefix ```terraform data "netbox_prefix" "test" { - cidr = "10.0.0.0/24" + cidr = "10.0.0.0/24" } resource "netbox_available_ip_address" "test" { prefix_id = data.netbox_prefix.test.id - status = "reserved" - dns_name = "test.mydomain.local" +} +``` +### Creating an IP in an IP range +```terraform +data "netbox_ip_range" "test" { + start_address = "10.0.0.1/24" + end_address = "10.0.0.50/24" +} + +resource "netbox_available_ip_address" "test" { + ip_range_id = data.netbox_ip_range.test.id } ``` @@ -43,22 +52,22 @@ resource "netbox_available_ip_address" "test" { ```terraform // Assumes Netbox already has a VM whos name matches 'dc-west-myvm-20' data "netbox_virtual_machine" "myvm" { - name_regex = "dc-west-myvm-20" + name_regex = "dc-west-myvm-20" } data "netbox_prefix" "test" { - cidr = "10.0.0.0/24" + cidr = "10.0.0.0/24" } resource "netbox_interface" "myvm-eth0" { - name = "eth0" - virtual_machine_id = data.netbox_virtual_machine.myvm.id + name = "eth0" + virtual_machine_id = data.netbox_virtual_machine.myvm.id } resource "netbox_available_ip_address" "myvm-ip" { - prefix_id = data.netbox_prefix.test.id - status = "active" - interface_id = netbox_interface.myvm-eth0.id + prefix_id = data.netbox_prefix.test.id + status = "active" + interface_id = netbox_interface.myvm-eth0.id } ``` @@ -67,16 +76,15 @@ resource "netbox_available_ip_address" "myvm-ip" { ### Required -- **prefix_id** (String) -- **status** (String) +- Either **prefix_id** or **ip_range_id** (String) ### Optional +- **status** (String) Defaults to "active". Choose from "active", "reserved", "deprecated", "dhcp", or "slaac" - **dns_name** (String) - **id** (String) The ID of this resource. - **interface_id** (Number) - **tags** (Set of String) - **tenant_id** (Number) - **vrf_id** (Number) - - +- **description** (String)