Skip to content

Commit 8b20371

Browse files
committed
docs: update provider documentation and examples
1 parent f5a4c84 commit 8b20371

18 files changed

Lines changed: 1137 additions & 1 deletion

File tree

.goreleaser.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,31 @@ builds:
2929
- darwin
3030
- linux
3131
- windows
32+
- freebsd
3233
goarch:
3334
- amd64
3435
- arm64
36+
- arm
37+
- 386
38+
goarm:
39+
- "6"
40+
- "7"
3541
ignore:
42+
# Windows doesn't support ARM
3643
- goos: windows
3744
goarch: arm64
45+
- goos: windows
46+
goarch: arm
47+
# Darwin doesn't support 386 or ARMv6/v7
48+
- goos: darwin
49+
goarch: 386
50+
- goos: darwin
51+
goarch: arm
52+
# FreeBSD only supports amd64 and 386
53+
- goos: freebsd
54+
goarch: arm64
55+
- goos: freebsd
56+
goarch: arm
3857

3958
# Archive configuration
4059
archives:

docs/BUILD_MATRIX.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Build Matrix for Terraform Registry
2+
3+
This document outlines the OS and architecture combinations that are built for the Pocket-ID Terraform provider.
4+
5+
## Terraform Registry Requirements
6+
7+
According to [Terraform Registry documentation](https://developer.hashicorp.com/terraform/registry/providers/os-arch), providers should build for the following platforms:
8+
9+
### Required Platforms ✅
10+
11+
-**Darwin (macOS) / AMD64** - Intel Macs
12+
-**Darwin (macOS) / ARM64** - Apple Silicon Macs (M1/M2/M3)
13+
-**Linux / AMD64** - Standard Linux x86_64 (required for HCP Terraform)
14+
-**Linux / ARM64** - Linux on ARM64/AArch64
15+
-**Linux / ARMv6** - Linux on ARM v6 (Raspberry Pi, etc.)
16+
-**Windows / AMD64** - Windows 64-bit
17+
18+
### Recommended Platforms ✅
19+
20+
-**Linux / 386** - Linux 32-bit
21+
-**Windows / 386** - Windows 32-bit
22+
-**FreeBSD / 386** - FreeBSD 32-bit
23+
-**FreeBSD / AMD64** - FreeBSD 64-bit
24+
25+
## Current Build Configuration
26+
27+
Based on `.goreleaser.yml`, the following platforms are built:
28+
29+
### Darwin (macOS)
30+
31+
- `darwin/amd64` - Intel Macs
32+
- `darwin/arm64` - Apple Silicon Macs
33+
34+
### Linux
35+
36+
- `linux/386` - 32-bit
37+
- `linux/amd64` - 64-bit (CGO disabled for HCP Terraform compatibility)
38+
- `linux/arm64` - ARM64/AArch64
39+
- `linux/arm/6` - ARMv6 (Raspberry Pi Zero, Pi 1)
40+
- `linux/arm/7` - ARMv7 (Raspberry Pi 2+)
41+
42+
### Windows
43+
44+
- `windows/386` - 32-bit
45+
- `windows/amd64` - 64-bit
46+
47+
### FreeBSD
48+
49+
- `freebsd/386` - 32-bit
50+
- `freebsd/amd64` - 64-bit
51+
52+
## Build Settings
53+
54+
All binaries are built with:
55+
56+
- **CGO_ENABLED=0** - Static binaries with no external dependencies
57+
- **-trimpath** flag - Reproducible builds
58+
- **Proper versioning** - Version, commit, and date embedded in binaries
59+
60+
This configuration ensures compatibility with Terraform Registry requirements and HCP Terraform.

docs/data-sources/client.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,52 @@ description: |-
1010

1111
Fetches an OIDC client from Pocket-ID by its ID.
1212

13+
## Example Usage
1314

15+
```terraform
16+
# First create a client
17+
resource "pocketid_client" "app" {
18+
name = "My Application"
19+
20+
callback_urls = [
21+
"https://app.example.com/callback"
22+
]
23+
24+
is_public = false
25+
}
26+
27+
# Fetch the client by ID
28+
data "pocketid_client" "app" {
29+
client_id = pocketid_client.app.id
30+
}
31+
32+
# Use the client data
33+
output "client_name" {
34+
value = data.pocketid_client.app.name
35+
}
36+
37+
output "client_callback_urls" {
38+
value = data.pocketid_client.app.callback_urls
39+
}
40+
41+
output "client_has_logo" {
42+
value = data.pocketid_client.app.has_logo
43+
}
44+
45+
# Example of fetching an existing client by known ID
46+
data "pocketid_client" "existing" {
47+
client_id = "550e8400-e29b-41d4-a716-446655440000"
48+
}
49+
50+
# Check client configuration
51+
output "existing_client_is_public" {
52+
value = data.pocketid_client.existing.is_public
53+
}
54+
55+
output "existing_client_pkce_enabled" {
56+
value = data.pocketid_client.existing.pkce_enabled
57+
}
58+
```
1459

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

docs/data-sources/clients.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,68 @@ description: |-
1010

1111
Fetches all OIDC clients from Pocket-ID.
1212

13+
## Example Usage
1314

15+
```terraform
16+
# Fetch all OIDC clients
17+
data "pocketid_clients" "all" {}
18+
19+
# Output total client count
20+
output "total_clients" {
21+
value = length(data.pocketid_clients.all.clients)
22+
}
23+
24+
# List all client names
25+
output "client_names" {
26+
value = [for client in data.pocketid_clients.all.clients : client.name]
27+
}
28+
29+
# Find public clients
30+
locals {
31+
public_clients = [
32+
for client in data.pocketid_clients.all.clients : client
33+
if client.is_public
34+
]
35+
36+
confidential_clients = [
37+
for client in data.pocketid_clients.all.clients : client
38+
if !client.is_public
39+
]
40+
}
41+
42+
output "public_client_count" {
43+
value = length(local.public_clients)
44+
}
45+
46+
output "confidential_client_count" {
47+
value = length(local.confidential_clients)
48+
}
49+
50+
# Create a map of clients by name
51+
locals {
52+
clients_by_name = {
53+
for client in data.pocketid_clients.all.clients : client.name => client
54+
}
55+
}
56+
57+
# Access a specific client from the map
58+
output "spa_client_id" {
59+
value = lookup(local.clients_by_name, "React SPA Application", null) != null ? local.clients_by_name["React SPA Application"].id : "Client not found"
60+
}
61+
62+
# Find clients with specific callback URLs
63+
locals {
64+
localhost_clients = [
65+
for client in data.pocketid_clients.all.clients : client
66+
if anytrue([for url in client.callback_urls : can(regex("localhost", url))])
67+
]
68+
}
69+
70+
output "development_clients" {
71+
description = "Clients configured for localhost development"
72+
value = [for client in local.localhost_clients : client.name]
73+
}
74+
```
1475

1576
<!-- schema generated by tfplugindocs -->
1677
## Schema
@@ -20,6 +81,7 @@ Fetches all OIDC clients from Pocket-ID.
2081
- `clients` (Attributes List) List of all OIDC clients. (see [below for nested schema](#nestedatt--clients))
2182

2283
<a id="nestedatt--clients"></a>
84+
2385
### Nested Schema for `clients`
2486

2587
Read-Only:

docs/data-sources/user.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,40 @@ description: |-
1010

1111
Fetches a user from Pocket-ID by their ID.
1212

13+
## Example Usage
1314

15+
```terraform
16+
# First create a user
17+
resource "pocketid_user" "example" {
18+
username = "john.doe"
19+
email = "john.doe@example.com"
20+
first_name = "John"
21+
last_name = "Doe"
22+
}
23+
24+
# Then fetch the user by ID
25+
data "pocketid_user" "example" {
26+
id = pocketid_user.example.id
27+
}
28+
29+
# Use the user data
30+
output "user_email" {
31+
value = data.pocketid_user.example.email
32+
}
33+
34+
output "user_groups" {
35+
value = data.pocketid_user.example.groups
36+
}
37+
38+
output "user_is_admin" {
39+
value = data.pocketid_user.example.is_admin
40+
}
41+
42+
# Example of fetching an existing user by known ID
43+
data "pocketid_user" "existing" {
44+
id = "123e4567-e89b-12d3-a456-426614174000"
45+
}
46+
```
1447

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

docs/data-sources/users.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,60 @@ description: |-
1010

1111
Fetches all users from Pocket-ID.
1212

13+
## Example Usage
1314

15+
```terraform
16+
# Fetch all users
17+
data "pocketid_users" "all" {}
18+
19+
# Output total user count
20+
output "total_users" {
21+
value = length(data.pocketid_users.all.users)
22+
}
23+
24+
# Output all user emails
25+
output "user_emails" {
26+
value = [for user in data.pocketid_users.all.users : user.email]
27+
}
28+
29+
# Find admin users
30+
locals {
31+
admin_users = [
32+
for user in data.pocketid_users.all.users : user
33+
if user.is_admin
34+
]
35+
}
36+
37+
output "admin_count" {
38+
value = length(local.admin_users)
39+
}
40+
41+
# Filter users by group membership
42+
resource "pocketid_group" "developers" {
43+
name = "developers"
44+
friendly_name = "Development Team"
45+
}
46+
47+
data "pocketid_users" "developers" {
48+
group_id = pocketid_group.developers.id
49+
}
50+
51+
output "developers_count" {
52+
value = length(data.pocketid_users.developers.users)
53+
}
54+
55+
# Create a map of users by username
56+
locals {
57+
users_by_username = {
58+
for user in data.pocketid_users.all.users : user.username => user
59+
}
60+
}
61+
62+
# Access a specific user from the map
63+
output "john_doe_email" {
64+
value = lookup(local.users_by_username, "john.doe", null) != null ? local.users_by_username["john.doe"].email : "User not found"
65+
}
66+
```
1467

1568
<!-- schema generated by tfplugindocs -->
1669
## Schema
@@ -20,6 +73,7 @@ Fetches all users from Pocket-ID.
2073
- `users` (Attributes List) List of all users. (see [below for nested schema](#nestedatt--users))
2174

2275
<a id="nestedatt--users"></a>
76+
2377
### Nested Schema for `users`
2478

2579
Read-Only:

0 commit comments

Comments
 (0)