Skip to content

Commit 22c0538

Browse files
author
Andreas Nieß
committed
feat: Add default importer function to resources
Fix smutel#51
1 parent 39ac08b commit 22c0538

20 files changed

+109
-0
lines changed

docs/resources/ipam_aggregate.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,11 @@ The ``tag`` block supports:
4949

5050
In addition to the above arguments, the following attributes are exported:
5151
* ``id`` - The id (ref in Netbox) of this object.
52+
53+
## Import
54+
55+
Aggregates can be imported by `id` e.g.
56+
57+
```
58+
$ terraform import netbox_ipam_aggregate.aggregate_test id
59+
```

docs/resources/ipam_ip_addresses.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@ The ``tag`` block supports:
5858

5959
In addition to the above arguments, the following attributes are exported:
6060
* ``id`` - The id (ref in Netbox) of this object.
61+
62+
## Import
63+
64+
Ip addresses can be imported by `id` e.g.
65+
66+
```
67+
$ terraform import netbox_ipam_ip_addresses.ip_test id
68+
```

docs/resources/ipam_prefix.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,10 @@ The ``tag`` block supports:
4242
In addition to the above arguments, the following attributes are exported:
4343
* ``id`` - The id (ref in Netbox) of this object.
4444

45+
## Import
46+
47+
Prefixes can be imported by `id` e.g.
48+
49+
```
50+
$ terraform import netbox_ipam_prefix.prefix_test id
51+
```

docs/resources/ipam_service.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ The ``tag`` block supports:
5555

5656
In addition to the above arguments, the following attributes are exported:
5757
* ``id`` - The id (ref in Netbox) of this object.
58+
59+
## Import
60+
61+
Services can be imported by `id` e.g.
62+
63+
```
64+
$ terraform import netbox_ipam_service.service_test id
65+
```

docs/resources/ipam_vlan.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@ The ``tag`` block supports:
5757

5858
In addition to the above arguments, the following attributes are exported:
5959
* ``id`` - The id (ref in Netbox) of this object.
60+
61+
## Import
62+
63+
Vlans can be imported by `id` e.g.
64+
65+
```
66+
$ terraform import netbox_ipam_vlan.vlan_test id
67+
```

docs/resources/ipam_vlan_group.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ The following arguments are supported:
2323

2424
In addition to the above arguments, the following attributes are exported:
2525
* ``id`` - The id (ref in Netbox) of this object.
26+
27+
## Import
28+
29+
Vlan groups can be imported by `id` e.g.
30+
31+
```
32+
$ terraform import netbox_ipam_vlan_group.vlan_group_test id
33+
```

docs/resources/tenancy_tenant.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ The ``tag`` block supports:
5252

5353
In addition to the above arguments, the following attributes are exported:
5454
* ``id`` - The id (ref in Netbox) of this object.
55+
56+
## Import
57+
58+
Tenants can be imported by `id` e.g.
59+
60+
```
61+
$ terraform import netbox_tenancy_tenant.tenant_test id
62+
```

docs/resources/tenancy_tenant_group.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ The following arguments are supported:
2121

2222
In addition to the above arguments, the following attributes are exported:
2323
* ``id`` - The id (ref in Netbox) of this object.
24+
25+
## Import
26+
27+
Tenant groups can be imported by `id` e.g.
28+
29+
```
30+
$ terraform import netbox_tenancy_tenant_group.tenant_group_test id
31+
```

docs/resources/virtualization_interface.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ The ``tag`` block supports:
3535

3636
In addition to the above arguments, the following attributes are exported:
3737
* ``id`` - The id (ref in Netbox) of this object.
38+
39+
## Import
40+
41+
Virtualization interfaces can be imported by `id` e.g.
42+
43+
```
44+
$ terraform import netbox_virtualization_interface.interface_test id
45+
```

docs/resources/virtualization_vm.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@ The ``tag`` block supports:
5757

5858
In addition to the above arguments, the following attributes are exported:
5959
* ``id`` - The id (ref in Netbox) of this object.
60+
61+
## Import
62+
63+
Virtualization vms can be imported by `id` e.g.
64+
65+
```
66+
$ terraform import netbox_virtualization_vm.vm_test id
67+
```

netbox/resource_netbox_ipam_aggregate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ func resourceNetboxIpamAggregate() *schema.Resource {
2020
Update: resourceNetboxIpamAggregateUpdate,
2121
Delete: resourceNetboxIpamAggregateDelete,
2222
Exists: resourceNetboxIpamAggregateExists,
23+
Importer: &schema.ResourceImporter{
24+
State: schema.ImportStatePassthrough,
25+
},
2326

2427
Schema: map[string]*schema.Schema{
2528
"custom_fields": {

netbox/resource_netbox_ipam_ip_addresses.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func resourceNetboxIpamIPAddresses() *schema.Resource {
1919
Update: resourceNetboxIpamIPAddressesUpdate,
2020
Delete: resourceNetboxIpamIPAddressesDelete,
2121
Exists: resourceNetboxIpamIPAddressesExists,
22+
Importer: &schema.ResourceImporter{
23+
State: schema.ImportStatePassthrough,
24+
},
2225

2326
Schema: map[string]*schema.Schema{
2427
"address": {

netbox/resource_netbox_ipam_prefix.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func resourceNetboxIpamPrefix() *schema.Resource {
1818
Update: resourceNetboxIpamPrefixUpdate,
1919
Delete: resourceNetboxIpamPrefixDelete,
2020
Exists: resourceNetboxIpamPrefixExists,
21+
Importer: &schema.ResourceImporter{
22+
State: schema.ImportStatePassthrough,
23+
},
2124

2225
Schema: map[string]*schema.Schema{
2326
"description": {

netbox/resource_netbox_ipam_service.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func resourceNetboxIpamService() *schema.Resource {
1818
Update: resourceNetboxIpamServiceUpdate,
1919
Delete: resourceNetboxIpamServiceDelete,
2020
Exists: resourceNetboxIpamServiceExists,
21+
Importer: &schema.ResourceImporter{
22+
State: schema.ImportStatePassthrough,
23+
},
2124

2225
Schema: map[string]*schema.Schema{
2326
"custom_fields": {

netbox/resource_netbox_ipam_vlan.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func resourceNetboxIpamVlan() *schema.Resource {
1818
Update: resourceNetboxIpamVlanUpdate,
1919
Delete: resourceNetboxIpamVlanDelete,
2020
Exists: resourceNetboxIpamVlanExists,
21+
Importer: &schema.ResourceImporter{
22+
State: schema.ImportStatePassthrough,
23+
},
2124

2225
Schema: map[string]*schema.Schema{
2326
"custom_fields": {

netbox/resource_netbox_ipam_vlan_group.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func resourceNetboxIpamVlanGroup() *schema.Resource {
1919
Update: resourceNetboxIpamVlanGroupUpdate,
2020
Delete: resourceNetboxIpamVlanGroupDelete,
2121
Exists: resourceNetboxIpamVlanGroupExists,
22+
Importer: &schema.ResourceImporter{
23+
State: schema.ImportStatePassthrough,
24+
},
2225

2326
Schema: map[string]*schema.Schema{
2427
"name": {

netbox/resource_netbox_tenancy_tenant.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func resourceNetboxTenancyTenant() *schema.Resource {
1919
Update: resourceNetboxTenancyTenantUpdate,
2020
Delete: resourceNetboxTenancyTenantDelete,
2121
Exists: resourceNetboxTenancyTenantExists,
22+
Importer: &schema.ResourceImporter{
23+
State: schema.ImportStatePassthrough,
24+
},
2225

2326
Schema: map[string]*schema.Schema{
2427
"comments": {

netbox/resource_netbox_tenancy_tenant_group.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func resourceNetboxTenancyTenantGroup() *schema.Resource {
1919
Update: resourceNetboxTenancyTenantGroupUpdate,
2020
Delete: resourceNetboxTenancyTenantGroupDelete,
2121
Exists: resourceNetboxTenancyTenantGroupExists,
22+
Importer: &schema.ResourceImporter{
23+
State: schema.ImportStatePassthrough,
24+
},
2225

2326
Schema: map[string]*schema.Schema{
2427
"name": {

netbox/resource_netbox_virtualization_interface.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func resourceNetboxVirtualizationInterface() *schema.Resource {
1919
Update: resourceNetboxVirtualizationInterfaceUpdate,
2020
Delete: resourceNetboxVirtualizationInterfaceDelete,
2121
Exists: resourceNetboxVirtualizationInterfaceExists,
22+
Importer: &schema.ResourceImporter{
23+
State: schema.ImportStatePassthrough,
24+
},
2225

2326
Schema: map[string]*schema.Schema{
2427
"description": {

netbox/resource_netbox_virtualization_vm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func resourceNetboxVirtualizationVM() *schema.Resource {
1818
Update: resourceNetboxVirtualizationVMUpdate,
1919
Delete: resourceNetboxVirtualizationVMDelete,
2020
Exists: resourceNetboxVirtualizationVMExists,
21+
Importer: &schema.ResourceImporter{
22+
State: schema.ImportStatePassthrough,
23+
},
2124

2225
Schema: map[string]*schema.Schema{
2326
"cluster_id": {

0 commit comments

Comments
 (0)