feat: generated docs, and original workflows

This commit is contained in:
allanice001
2025-11-06 02:36:17 +00:00
parent ea26b8526c
commit fa6f7ede1f
18 changed files with 630 additions and 2 deletions

View File

@@ -1,23 +1,71 @@
# ---- Provider build/dev settings ----
BIN ?= terraform-provider-autoglue
VER ?= 0.0.1
OS ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH ?= $(shell uname -m | sed 's/x86_64/amd64/;s/arm64/arm64/')
PROVIDER_SRC ?= glueops/autoglue/autoglue
.PHONY: build tidy dev clean
# ---- tfplugindocs settings ----
# Where Go places binaries
BIN_DIR := $(shell go env GOBIN)
ifeq ($(BIN_DIR),)
BIN_DIR := $(shell go env GOPATH)/bin
endif
DOCS_BIN := $(BIN_DIR)/tfplugindocs
DOCS_DIR ?= docs
.PHONY: build tidy dev clean tools docs docs-validate docs-clean docs-readme
# Build the provider binary in the repo root
build:
go build -o $(BIN) .
# Tidy module deps
tidy:
go mod tidy
# Install the provider locally for Terraform/OpenTofu as a dev provider
dev:
@echo "Installing dev provider v$(VER) for $(OS)_$(ARCH)..."
@DST="$${HOME}/.terraform.d/plugins/glueops/autoglue/autoglue/$(VER)/$(OS)_$(ARCH)"; \
@DST="$${HOME}/.terraform.d/plugins/$(PROVIDER_SRC)/$(VER)/$(OS)_$(ARCH)"; \
mkdir -p "$$DST"; \
go build -o "$$DST/terraform-provider-autoglue_v$(VER)" .; \
echo "Provider installed to $$DST"; \
echo "Run: terraform init -upgrade"
# Remove build artifacts (and optionally generated docs if desired)
clean:
rm -f $(BIN)
# ---------- Docs via tfplugindocs ----------
# Ensure tfplugindocs is available; install if missing
tools:
@set -e; \
if [ ! -x "$(DOCS_BIN)" ]; then \
echo "tfplugindocs not found. Installing..."; \
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest; \
echo "Installed tfplugindocs to $(DOCS_BIN)"; \
else \
echo "tfplugindocs found at $(DOCS_BIN)"; \
fi
# Generate docs from your Go schemas into ./docs
docs: tools
@echo "Generating provider docs into ./$(DOCS_DIR)..."
@$(DOCS_BIN)
@echo "Done. See ./$(DOCS_DIR)"
# Validate docs are up-to-date (useful in CI)
docs-validate: tools
@$(DOCS_BIN) validate
# Clean generated docs
docs-clean:
@rm -rf $(DOCS_DIR)
# OPTIONAL: copy the generated landing page to README.md
docs-readme: docs
@[ -f "$(DOCS_DIR)/index.md" ] && cp "$(DOCS_DIR)/index.md" README.md || \
(echo "$(DOCS_DIR)/index.md not found. Did doc generation run?"; exit 1)
@echo "README.md updated from $(DOCS_DIR)/index.md"

View File

@@ -0,0 +1,24 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue Provider"
description: |-
---
# autoglue Provider
<!-- schema generated by tfplugindocs -->
## Schema
### Optional
- `addr` (String) Base URL to the autoglue API (e.g. https://autoglue.example.com/api/v1). Defaults to http://localhost:8080/api/v1.
- `api_key` (String, Sensitive) User API key for key-only auth.
- `bearer` (String, Sensitive) Bearer token (user access token).
- `org_id` (String) Organization ID (UUID). Required for user/bearer and user API key auth unless single-org membership. Omitted for org key/secret (derived server-side).
- `org_key` (String, Sensitive) Org-scoped key for machine auth.
- `org_secret` (String, Sensitive) Org-scoped secret for machine auth.

View File

@@ -0,0 +1,33 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_annotations Data Source - terraform-provider-autoglue"
subcategory: ""
description: |-
List annotations for the organization (org-scoped).
---
# autoglue_annotations (Data Source)
List annotations for the organization (org-scoped).
<!-- schema generated by tfplugindocs -->
## Schema
### Read-Only
- `items` (Attributes List) Annotations returned by the API. (see [below for nested schema](#nestedatt--items))
<a id="nestedatt--items"></a>
### Nested Schema for `items`
Read-Only:
- `created_at` (String) RFC3339, UTC.
- `id` (String) Taint ID (UUID).
- `key` (String)
- `organization_id` (String)
- `raw` (String) Full JSON for the item.
- `updated_at` (String) RFC3339, UTC.
- `value` (String)

View File

@@ -0,0 +1,33 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_labels Data Source - terraform-provider-autoglue"
subcategory: ""
description: |-
List labels for the organization (org-scoped).
---
# autoglue_labels (Data Source)
List labels for the organization (org-scoped).
<!-- schema generated by tfplugindocs -->
## Schema
### Read-Only
- `items` (Attributes List) Labels returned by the API. (see [below for nested schema](#nestedatt--items))
<a id="nestedatt--items"></a>
### Nested Schema for `items`
Read-Only:
- `created_at` (String) RFC3339, UTC.
- `id` (String) Taint ID (UUID).
- `key` (String)
- `organization_id` (String)
- `raw` (String) Full JSON for the item.
- `updated_at` (String) RFC3339, UTC.
- `value` (String)

View File

@@ -0,0 +1,43 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_servers Data Source - terraform-provider-autoglue"
subcategory: ""
description: |-
List servers for the organization (org-scoped).
---
# autoglue_servers (Data Source)
List servers for the organization (org-scoped).
<!-- schema generated by tfplugindocs -->
## Schema
### Optional
- `role` (String) Filter by role.
- `status` (String) Filter by status (pending|provisioning|ready|failed).
### Read-Only
- `items` (Attributes List) Servers returned by the API. (see [below for nested schema](#nestedatt--items))
<a id="nestedatt--items"></a>
### Nested Schema for `items`
Read-Only:
- `created_at` (String) RFC3339, UTC.
- `hostname` (String)
- `id` (String) Server ID (UUID).
- `organization_id` (String)
- `private_ip_address` (String)
- `public_ip_address` (String)
- `raw` (String) Full JSON for the item.
- `role` (String)
- `ssh_key_id` (String)
- `ssh_user` (String)
- `status` (String)
- `updated_at` (String) RFC3339, UTC.

View File

@@ -0,0 +1,37 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_ssh_keys Data Source - terraform-provider-autoglue"
subcategory: ""
description: |-
---
# autoglue_ssh_keys (Data Source)
<!-- schema generated by tfplugindocs -->
## Schema
### Optional
- `fingerprint` (String) Filter by exact fingerprint (client-side).
- `name_contains` (String) Filter by substring of name (client-side).
### Read-Only
- `keys` (Attributes List) SSH keys (see [below for nested schema](#nestedatt--keys))
<a id="nestedatt--keys"></a>
### Nested Schema for `keys`
Read-Only:
- `created_at` (String)
- `fingerprint` (String)
- `id` (String)
- `name` (String)
- `public_key` (String)
- `updated_at` (String)

View File

@@ -0,0 +1,34 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_taints Data Source - terraform-provider-autoglue"
subcategory: ""
description: |-
List taints for the organization (org-scoped).
---
# autoglue_taints (Data Source)
List taints for the organization (org-scoped).
<!-- schema generated by tfplugindocs -->
## Schema
### Read-Only
- `items` (Attributes List) Taints returned by the API. (see [below for nested schema](#nestedatt--items))
<a id="nestedatt--items"></a>
### Nested Schema for `items`
Read-Only:
- `created_at` (String) RFC3339, UTC.
- `effect` (String)
- `id` (String) Taint ID (UUID).
- `key` (String)
- `organization_id` (String)
- `raw` (String) Full JSON for the item.
- `updated_at` (String) RFC3339, UTC.
- `value` (String)

View File

@@ -0,0 +1,24 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue Provider"
description: |-
---
# autoglue Provider
<!-- schema generated by tfplugindocs -->
## Schema
### Optional
- `addr` (String) Base URL to the autoglue API (e.g. https://autoglue.example.com/api/v1). Defaults to http://localhost:8080/api/v1.
- `api_key` (String, Sensitive) User API key for key-only auth.
- `bearer` (String, Sensitive) Bearer token (user access token).
- `org_id` (String) Organization ID (UUID). Required for user/bearer and user API key auth unless single-org membership. Omitted for org key/secret (derived server-side).
- `org_key` (String, Sensitive) Org-scoped key for machine auth.
- `org_secret` (String, Sensitive) Org-scoped secret for machine auth.

View File

@@ -0,0 +1,52 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "{{ .ProviderName }} Provider"
description: |-x
{{ .ProviderDescription }}
---
# {{ .ProviderName }} Provider
${{ .ProviderDescription }}
## Quick Start
~~{hul}hcl
terraform {
required_providers {
{{ .ProviderName }} = {
source = "{{ .ProviderSource }}"
# version = ">= 0.0.1"
}
}
}
provider "{{ .ProviderName }}" {
# addr = "https://api.example.com/api/v1"
# api_key = "angykey"
# bearer = "accesstoken"
# org_id = "..."
# org_key = "---"
# org_secret = "---"
}
~~{hul}
## Resources
{{- if .Resources }}
{{- range .Resources }}
- [{+ .Name }](./resources/{{ .FileName }})
{{- end }}
{{- else }}
_No resources yet._
{{- end }}
## Data Sources
{{- if .DataSources }}
{{- range .DataSources }}
- [{+.Name }(./data-sources/{{ .FileName }})
{{- end }}
{{- else }}
_No data sources yet._
{{- end }}
<-- schema generated by tfplugindocs --=

View File

@@ -0,0 +1,29 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_annotation Resource - terraform-provider-autoglue"
subcategory: ""
description: |-
Create and manage a annotation (org-scoped).
---
# autoglue_annotation (Resource)
Create and manage a annotation (org-scoped).
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `key` (String) Key.
- `value` (String) Value.
### Read-Only
- `created_at` (String)
- `id` (String) ID (UUID).
- `organization_id` (String)
- `raw` (String) Full server JSON from API.
- `updated_at` (String)

View File

@@ -0,0 +1,29 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_label Resource - terraform-provider-autoglue"
subcategory: ""
description: |-
Create and manage a label (org-scoped).
---
# autoglue_label (Resource)
Create and manage a label (org-scoped).
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `key` (String) Key.
- `value` (String) Value.
### Read-Only
- `created_at` (String)
- `id` (String) Server ID (UUID).
- `organization_id` (String)
- `raw` (String) Full server JSON from API.
- `updated_at` (String)

View File

@@ -0,0 +1,37 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_server Resource - terraform-provider-autoglue"
subcategory: ""
description: |-
Create and manage a server (org-scoped). Mirrors API validation for role/status/ssh_key_id.
---
# autoglue_server (Resource)
Create and manage a server (org-scoped). Mirrors API validation for role/status/ssh_key_id.
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `hostname` (String) Hostname.
- `private_ip_address` (String) Private IP address (required).
- `role` (String) Server role (e.g., agent/manager/bastion). Lowercased by the provider.
- `ssh_key_id` (String) SSH key ID (UUID) that belongs to the org.
- `ssh_user` (String) SSH username (required).
### Optional
- `public_ip_address` (String) Public IP address (required when role = bastion).
- `status` (String) Status (pending|provisioning|ready|failed). Lowercased by the provider.
### Read-Only
- `created_at` (String)
- `id` (String) Server ID (UUID).
- `organization_id` (String)
- `raw` (String) Full server JSON from API.
- `updated_at` (String)

View File

@@ -0,0 +1,35 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_ssh_key Resource - terraform-provider-autoglue"
subcategory: ""
description: |-
---
# autoglue_ssh_key (Resource)
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `comment` (String) Comment appended to authorized key
- `name` (String) Display name
### Optional
- `bits` (Number) RSA key size (2048/3072/4096). Ignored for ed25519.
- `type` (String) Key type: rsa or ed25519 (default rsa)
### Read-Only
- `created_at` (String) Creation time (RFC3339, UTC)
- `fingerprint` (String) SHA256 fingerprint
- `id` (String) SSH key ID (UUID)
- `private_key_pem` (String, Sensitive) Private key PEM (resource doesnt reveal; stays empty).
- `public_key` (String) OpenSSH authorized key
- `updated_at` (String) Update time (RFC3339, UTC)

View File

@@ -0,0 +1,30 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "autoglue_taint Resource - terraform-provider-autoglue"
subcategory: ""
description: |-
Create and manage a taint (org-scoped).
---
# autoglue_taint (Resource)
Create and manage a taint (org-scoped).
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `effect` (String) Effect.
- `key` (String) Key.
- `value` (String) Value.
### Read-Only
- `created_at` (String)
- `id` (String) Server ID (UUID).
- `organization_id` (String)
- `raw` (String) Full server JSON from API.
- `updated_at` (String)

Binary file not shown.