Skip to content

Commit

Permalink
Initial port to nautobot 2 (#17)
Browse files Browse the repository at this point in the history
* Initial port to nautobot 2

* Fix API authentication

* Fix API auth in data source

* Fix Manufacturer creation

* Add cluster_type resource and data source

* Add cluster resource and data source

* Add Virtual Machine data source and resource

* Add all data sources and single data sources

* Add VLAN and VLANs data sources

* Fix data source ID and add Prefix data sources

* Add VM Interface resource

* Add available_ip and vm_primary_ip resources

* Cleanup code

* Switch to official go-nautobot

Signed-off-by: TobiPeterG <[email protected]>

* Update to go 1.23

* Update docs

* Rename available_ip to available_ip_address

* Support setting dns_name in available_ip_address resource

* Update terraform protocol

* Fix github CI

---------

Signed-off-by: TobiPeterG <[email protected]>
  • Loading branch information
TobiPeterG authored Oct 14, 2024
1 parent 9a47199 commit afe2e56
Show file tree
Hide file tree
Showing 52 changed files with 5,209 additions and 353 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: opentofu/setup-opentofu@v1
with:
go-version-file: "go.mod"
cache: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ website/node_modules
test/.terraform.lock.hcl
website/vendor
test/*.tfplan
test/*tfplan

# Test exclusions
!command/test-fixtures/**/*.tfstate
Expand Down
28 changes: 28 additions & 0 deletions docs/data-sources/available_ip_address.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_available_ip_address Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
This data source retrieves an available IP address from a given prefix in Nautobot
---

# nautobot_available_ip_address (Data Source)

This data source retrieves an available IP address from a given prefix in Nautobot



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `prefix_id` (String) The ID of the prefix from which to retrieve an available IP.

### Read-Only

- `address` (String) The available IP address.
- `id` (String) The ID of this resource.
- `ip_version` (Number) The version of the IP address (4 or 6).


34 changes: 34 additions & 0 deletions docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_cluster Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about a specific cluster in Nautobot.
---

# nautobot_cluster (Data Source)

Retrieves information about a specific cluster in Nautobot.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the cluster.

### Read-Only

- `cluster_group_id` (String) The ID of the cluster group.
- `cluster_type_id` (String) The ID of the cluster type.
- `comments` (String) Comments or notes about the cluster.
- `created` (String) The creation date of the cluster.
- `id` (String) The UUID of the cluster.
- `last_updated` (String) The last update date of the cluster.
- `location_id` (String) The ID of the location associated with the cluster.
- `tags_ids` (List of String) The IDs of the tags associated with the cluster.
- `tenant_id` (String) The ID of the tenant associated with the cluster.


34 changes: 34 additions & 0 deletions docs/data-sources/cluster_type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_cluster_type Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about a specific cluster type in Nautobot.
---

# nautobot_cluster_type (Data Source)

Retrieves information about a specific cluster type in Nautobot.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the cluster type to retrieve.

### Read-Only

- `created` (String) The date the cluster type was created.
- `description` (String) The description of the cluster type.
- `display` (String) Human-friendly display value for the cluster type.
- `id` (String) The UUID of the cluster type.
- `last_updated` (String) The date the cluster type was last updated.
- `natural_slug` (String) Natural slug for the cluster type.
- `notes_url` (String) Notes URL for the cluster type.
- `object_type` (String) Object type of the cluster type.
- `url` (String) URL of the cluster type.


39 changes: 39 additions & 0 deletions docs/data-sources/cluster_types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_cluster_types Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about cluster types in Nautobot.
---

# nautobot_cluster_types (Data Source)

Retrieves information about cluster types in Nautobot.



<!-- schema generated by tfplugindocs -->
## Schema

### Read-Only

- `cluster_types` (List of Object) (see [below for nested schema](#nestedatt--cluster_types))
- `id` (String) The ID of this resource.

<a id="nestedatt--cluster_types"></a>
### Nested Schema for `cluster_types`

Read-Only:

- `created` (String)
- `description` (String)
- `display` (String)
- `id` (String)
- `last_updated` (String)
- `name` (String)
- `natural_slug` (String)
- `notes_url` (String)
- `object_type` (String)
- `url` (String)


39 changes: 39 additions & 0 deletions docs/data-sources/clusters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_clusters Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about clusters in Nautobot.
---

# nautobot_clusters (Data Source)

Retrieves information about clusters in Nautobot.



<!-- schema generated by tfplugindocs -->
## Schema

### Read-Only

- `clusters` (List of Object) (see [below for nested schema](#nestedatt--clusters))
- `id` (String) The ID of this resource.

<a id="nestedatt--clusters"></a>
### Nested Schema for `clusters`

Read-Only:

- `cluster_group_id` (String)
- `cluster_type_id` (String)
- `comments` (String)
- `created` (String)
- `id` (String)
- `last_updated` (String)
- `location_id` (String)
- `name` (String)
- `tags_ids` (List of String)
- `tenant_id` (String)


34 changes: 34 additions & 0 deletions docs/data-sources/manufacturer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_manufacturer Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about a specific manufacturer in Nautobot.
---

# nautobot_manufacturer (Data Source)

Retrieves information about a specific manufacturer in Nautobot.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the manufacturer to retrieve.

### Read-Only

- `created` (String) Manufacturer's creation date.
- `description` (String) Manufacturer's description.
- `display` (String) Human friendly display value for the manufacturer.
- `id` (String) Manufacturer's UUID.
- `last_updated` (String) Manufacturer's last update.
- `natural_slug` (String) Natural slug for the manufacturer.
- `notes_url` (String) Notes URL for the manufacturer.
- `object_type` (String) Object type of the manufacturer.
- `url` (String) URL of the manufacturer.


7 changes: 2 additions & 5 deletions docs/data-sources/manufacturers.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ Manufacturer data source in the Terraform provider Nautobot.
Read-Only:

- `created` (String)
- `custom_fields` (Map of String)
- `description` (String)
- `devicetype_count` (Number)
- `display` (String)
- `id` (String)
- `inventoryitem_count` (Number)
- `last_updated` (String)
- `name` (String)
- `natural_slug` (String)
- `notes_url` (String)
- `platform_count` (Number)
- `slug` (String)
- `object_type` (String)
- `url` (String)


35 changes: 35 additions & 0 deletions docs/data-sources/prefix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_prefix Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about a Prefix in Nautobot by its associated VLAN ID.
---

# nautobot_prefix (Data Source)

Retrieves information about a Prefix in Nautobot by its associated VLAN ID.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `vlan_id` (String) The UUID of the VLAN to retrieve the prefix for.

### Read-Only

- `created` (String) The creation date of the prefix.
- `description` (String) Description of the prefix.
- `id` (String) The UUID of the prefix.
- `last_updated` (String) The last update date of the prefix.
- `namespace_id` (String) The ID of the namespace associated with the prefix.
- `prefix` (String) The prefix.
- `rir_id` (String) The ID of the RIR associated with the prefix.
- `role_id` (String) The ID of the role associated with the prefix.
- `status` (String) The status of the prefix.
- `tenant_id` (String) The ID of the tenant associated with the prefix.


39 changes: 39 additions & 0 deletions docs/data-sources/prefixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_prefixes Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about all prefixes in Nautobot.
---

# nautobot_prefixes (Data Source)

Retrieves information about all prefixes in Nautobot.



<!-- schema generated by tfplugindocs -->
## Schema

### Read-Only

- `id` (String) The ID of this resource.
- `prefixes` (List of Object) (see [below for nested schema](#nestedatt--prefixes))

<a id="nestedatt--prefixes"></a>
### Nested Schema for `prefixes`

Read-Only:

- `created` (String)
- `description` (String)
- `id` (String)
- `last_updated` (String)
- `namespace_id` (String)
- `prefix` (String)
- `rir_id` (String)
- `role_id` (String)
- `status` (String)
- `tenant_id` (String)


40 changes: 40 additions & 0 deletions docs/data-sources/virtual_machine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nautobot_virtual_machine Data Source - terraform-provider-nautobot"
subcategory: ""
description: |-
Retrieves information about a specific virtual machine in Nautobot.
---

# nautobot_virtual_machine (Data Source)

Retrieves information about a specific virtual machine in Nautobot.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the virtual machine to retrieve.

### Read-Only

- `cluster_id` (String) The ID of the cluster associated with the virtual machine.
- `comments` (String) Comments or notes about the virtual machine.
- `created` (String) The creation date of the virtual machine.
- `disk` (Number) The disk size in GB.
- `id` (String) The UUID of the virtual machine.
- `last_updated` (String) The last update date of the virtual machine.
- `memory` (Number) The amount of memory in MB.
- `platform_id` (String) The ID of the platform associated with the virtual machine.
- `primary_ip4_id` (String) The ID of the primary IPv4 address.
- `primary_ip6_id` (String) The ID of the primary IPv6 address.
- `role_id` (String) The ID of the role associated with the virtual machine.
- `status` (String) The name of the status of the virtual machine.
- `tags_ids` (List of String) The IDs of the tags associated with the virtual machine.
- `tenant_id` (String) The ID of the tenant associated with the virtual machine.
- `vcpus` (Number) The number of virtual CPUs.


Loading

0 comments on commit afe2e56

Please sign in to comment.