Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provider | documentation generation #54

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/lint-test-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ jobs:
just test
just coverage

- name: Check Provider docs up to date
run: |
just generate-provider-docs
git diff --exit-code -- pkg/config-api-provider/docs

- name: Check Provider docs valid
run: just validate-provider-docs

- name: Upload Code Coverage Report
uses: codecov/codecov-action@v4
with:
Expand Down
28 changes: 21 additions & 7 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TMP_DIR := "tmp"
CONFIG_API_CLIENT_DIR := "pkg/config-api-client"
CONFIG_API_PROVIDER_DIR := "pkg/config-api-provider"
TOOLS_PROVIDER_DIR := "tools"
OPENAPI_SPEC := "pkg/config-api-client/api"
SOURCE_OPEN_API_SPEC_FILE := ".openapi.source.yaml"

Expand Down Expand Up @@ -75,12 +76,22 @@ tidy-provider:
test-provider +ARGS='':
cd {{ CONFIG_API_PROVIDER_DIR }} && TF_ACC=1 go test -v ./... -race -covermode=atomic -coverprofile=.coverage {{ ARGS }}

generate-provider-docs:
cd {{ TOOLS_PROVIDER_DIR }} && go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir ../{{ CONFIG_API_PROVIDER_DIR }} -provider-name uxi
sed -i.backup '/subcategory: ""/d' ./{{ CONFIG_API_PROVIDER_DIR }}/docs/index.md && rm ./{{ CONFIG_API_PROVIDER_DIR }}/docs/index.md.backup

validate-provider-docs:
cd {{ TOOLS_PROVIDER_DIR }} && go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs validate --provider-dir ../{{ CONFIG_API_PROVIDER_DIR }} -provider-name uxi

coverage-provider:
cd {{ CONFIG_API_PROVIDER_DIR }} && go tool cover -html=.coverage -o=.coverage.html

test:
just test-client
just test-provider
tidy-tools:
cd {{ TOOLS_PROVIDER_DIR }} && go mod tidy

test +ARGS='':
just test-client {{ ARGS }}
just test-provider {{ ARGS }}

coverage:
just coverage-client
Expand All @@ -97,14 +108,17 @@ fmt:
tidy:
just tidy-client
just tidy-provider
just tidy-tools

clean:
find . -name ".coverage*" -type f -delete

plan +ARGS='':
DEFAULT_EXAMPLE := "full-demo"

plan example=DEFAULT_EXAMPLE +ARGS='':
cd {{ CONFIG_API_PROVIDER_DIR }} && go install .
cd {{ CONFIG_API_PROVIDER_DIR }}/examples/full-demo && terraform plan {{ ARGS }}
cd {{ CONFIG_API_PROVIDER_DIR }}/examples/{{example}} && terraform plan {{ ARGS }}

apply +ARGS='':
apply example=DEFAULT_EXAMPLE +ARGS='':
cd {{ CONFIG_API_PROVIDER_DIR }} && go install .
cd {{ CONFIG_API_PROVIDER_DIR }}/examples/full-demo && terraform apply {{ ARGS }}
cd {{ CONFIG_API_PROVIDER_DIR }}/examples/{{example}} && terraform apply {{ ARGS }}
41 changes: 41 additions & 0 deletions pkg/config-api-provider/docs/data-sources/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "uxi_agent Data Source - uxi"
subcategory: ""
description: |-

---

# uxi_agent (Data Source)





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

### Required

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `address_note` (String)
- `ethernet_mac_address` (String)
- `id` (String) The ID of this resource.
- `latitude` (Number)
- `longitude` (Number)
- `model_number` (String)
- `name` (String)
- `notes` (String)
- `pcap_mode` (String)
- `serial` (String)
- `wifi_mac_address` (String)

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

Required:

- `agent_id` (String)
34 changes: 34 additions & 0 deletions pkg/config-api-provider/docs/data-sources/group.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: "uxi_group Data Source - uxi"
subcategory: ""
description: |-

---

# uxi_group (Data Source)





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

### Required

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `id` (String) The ID of this resource.
- `name` (String)
- `parent_group_id` (String)
- `path` (String)

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

Required:

- `group_id` (String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "uxi_network_group_assignment Data Source - uxi"
subcategory: ""
description: |-

---

# uxi_network_group_assignment (Data Source)





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

### Required

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `group_id` (String)
- `id` (String) The ID of this resource.
- `network_id` (String)

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

Required:

- `network_group_assignment_id` (String)
41 changes: 41 additions & 0 deletions pkg/config-api-provider/docs/data-sources/sensor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "uxi_sensor Data Source - uxi"
subcategory: ""
description: |-

---

# uxi_sensor (Data Source)





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

### Required

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `address_note` (String)
- `ethernet_mac_address` (String)
- `id` (String) The ID of this resource.
- `latitude` (Number)
- `longitude` (Number)
- `model_number` (String)
- `name` (String)
- `notes` (String)
- `pcap_mode` (String)
- `serial` (String)
- `wifi_mac_address` (String)

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

Required:

- `sensor_id` (String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "uxi_sensor_group_assignment Data Source - uxi"
subcategory: ""
description: |-

---

# uxi_sensor_group_assignment (Data Source)





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

### Required

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `group_id` (String)
- `id` (String) The ID of this resource.
- `sensor_id` (String)

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

Required:

- `sensor_group_assignment_id` (String)
39 changes: 39 additions & 0 deletions pkg/config-api-provider/docs/data-sources/wired_network.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: "uxi_wired_network Data Source - uxi"
subcategory: ""
description: |-

---

# uxi_wired_network (Data Source)





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

### Required

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `disable_edns` (Boolean)
- `dns_lookup_domain` (String)
- `external_connectivity` (Boolean)
- `id` (String) The ID of this resource.
- `ip_version` (String)
- `name` (String)
- `security` (String)
- `use_dns64` (Boolean)
- `vlan_id` (Number)

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

Required:

- `wired_network_id` (String)
41 changes: 41 additions & 0 deletions pkg/config-api-provider/docs/data-sources/wireless_network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "uxi_wireless_network Data Source - uxi"
subcategory: ""
description: |-

---

# uxi_wireless_network (Data Source)





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

### Required

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `band_locking` (String)
- `disable_edns` (Boolean)
- `dns_lookup_domain` (String)
- `external_connectivity` (Boolean)
- `hidden` (Boolean)
- `id` (String) The ID of this resource.
- `ip_version` (String)
- `name` (String)
- `security` (String)
- `ssid` (String)
- `use_dns64` (Boolean)

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

Required:

- `wireless_network_id` (String)
22 changes: 22 additions & 0 deletions pkg/config-api-provider/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "uxi Provider"
description: |-

---

# uxi Provider





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

### Optional

- `client_id` (String)
- `client_secret` (String, Sensitive)
- `host` (String)
- `token_url` (String)
29 changes: 29 additions & 0 deletions pkg/config-api-provider/docs/resources/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "uxi_agent Resource - uxi"
subcategory: ""
description: |-

---

# uxi_agent (Resource)





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

### Required

- `name` (String)

### Optional

- `notes` (String)
- `pcap_mode` (String)

### Read-Only

- `id` (String) The ID of this resource.
Loading
Loading