Skip to content

Commit 3cb888d

Browse files
committed
Add Terraform Registry documentation
- docs/index.md - Provider overview and authentication - docs/resources/power.md - turingpi_power resource - docs/resources/flash.md - turingpi_flash resource - docs/resources/node.md - turingpi_node resource
1 parent eefb233 commit 3cb888d

File tree

4 files changed

+292
-0
lines changed

4 files changed

+292
-0
lines changed

docs/index.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
page_title: "Turing Pi Provider"
3+
subcategory: ""
4+
description: |-
5+
Terraform provider for managing Turing Pi 2.5 BMC (Baseboard Management Controller).
6+
---
7+
8+
# Turing Pi Provider
9+
10+
The Turing Pi provider enables Terraform-based management of [Turing Pi 2.5](https://turingpi.com/) clusters through the BMC (Baseboard Management Controller) API.
11+
12+
## Features
13+
14+
- **Power Management** - Control power state of individual compute nodes
15+
- **Firmware Flashing** - Flash firmware images to nodes
16+
- **Boot Verification** - Monitor UART output to verify successful boot
17+
- **Node Provisioning** - Combined resource for complete node management
18+
19+
## Example Usage
20+
21+
```hcl
22+
terraform {
23+
required_providers {
24+
turingpi = {
25+
source = "jfreed-dev/turingpi"
26+
version = "1.0.2"
27+
}
28+
}
29+
}
30+
31+
provider "turingpi" {
32+
username = "root"
33+
password = "turing"
34+
endpoint = "https://turingpi.local"
35+
}
36+
37+
resource "turingpi_power" "node1" {
38+
node = 1
39+
state = true
40+
}
41+
```
42+
43+
## Authentication
44+
45+
The provider requires BMC credentials to authenticate with the Turing Pi board.
46+
47+
### Configuration Options
48+
49+
- `username` - (Required) BMC username. Can also be set via `TURINGPI_USERNAME` environment variable.
50+
- `password` - (Required) BMC password. Can also be set via `TURINGPI_PASSWORD` environment variable.
51+
- `endpoint` - (Optional) BMC API endpoint URL. Defaults to `https://turingpi.local`. Can also be set via `TURINGPI_ENDPOINT` environment variable.
52+
53+
### Using Environment Variables
54+
55+
```bash
56+
export TURINGPI_USERNAME=root
57+
export TURINGPI_PASSWORD=turing
58+
export TURINGPI_ENDPOINT=https://192.168.1.100
59+
```
60+
61+
```hcl
62+
provider "turingpi" {}
63+
```
64+
65+
## Resources
66+
67+
- [turingpi_power](resources/power.md) - Control node power state
68+
- [turingpi_flash](resources/flash.md) - Flash firmware to a node
69+
- [turingpi_node](resources/node.md) - Comprehensive node management

docs/resources/flash.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
page_title: "turingpi_flash Resource - Turing Pi"
3+
subcategory: ""
4+
description: |-
5+
Flashes firmware to a Turing Pi compute node.
6+
---
7+
8+
# turingpi_flash (Resource)
9+
10+
Flashes firmware to a Turing Pi compute node. Changes to `node` or `firmware_file` will trigger resource recreation (re-flash).
11+
12+
~> **Note:** Flashing firmware is a destructive operation. Ensure you have the correct firmware file for your compute module.
13+
14+
## Example Usage
15+
16+
```hcl
17+
resource "turingpi_flash" "node1" {
18+
node = 1
19+
firmware_file = "/path/to/firmware.img"
20+
}
21+
```
22+
23+
### Using Variables
24+
25+
```hcl
26+
variable "firmware_path" {
27+
description = "Path to the firmware image file"
28+
type = string
29+
}
30+
31+
resource "turingpi_flash" "node1" {
32+
node = 1
33+
firmware_file = var.firmware_path
34+
}
35+
36+
resource "turingpi_flash" "node2" {
37+
node = 2
38+
firmware_file = var.firmware_path
39+
}
40+
```
41+
42+
## Argument Reference
43+
44+
- `node` - (Required, Integer, ForceNew) The node ID (1-4). Changing this forces a new resource.
45+
- `firmware_file` - (Required, String, ForceNew) Path to the firmware image file. Changing this forces a new resource.
46+
47+
## Attribute Reference
48+
49+
In addition to all arguments above, the following attributes are exported:
50+
51+
- `id` - The resource identifier in the format `flash-{node}`.
52+
53+
## Import
54+
55+
Flash resources cannot be imported as they represent a one-time operation.

docs/resources/node.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
page_title: "turingpi_node Resource - Turing Pi"
3+
subcategory: ""
4+
description: |-
5+
Comprehensive management of a Turing Pi compute node including power control, firmware flashing, and boot verification.
6+
---
7+
8+
# turingpi_node (Resource)
9+
10+
Provides comprehensive management of a Turing Pi compute node, combining power control, firmware flashing, and boot verification into a single resource.
11+
12+
## Example Usage
13+
14+
### Basic Power Control
15+
16+
```hcl
17+
resource "turingpi_node" "node1" {
18+
node = 1
19+
power_state = "on"
20+
}
21+
```
22+
23+
### With Firmware Flashing
24+
25+
```hcl
26+
resource "turingpi_node" "node1" {
27+
node = 1
28+
power_state = "on"
29+
firmware_file = "/path/to/firmware.img"
30+
}
31+
```
32+
33+
### Full Provisioning with Boot Verification
34+
35+
```hcl
36+
resource "turingpi_node" "node1" {
37+
node = 1
38+
power_state = "on"
39+
firmware_file = "/path/to/firmware.img"
40+
boot_check = true
41+
login_prompt_timeout = 120
42+
}
43+
```
44+
45+
### Complete Cluster Setup
46+
47+
```hcl
48+
variable "firmware_path" {
49+
description = "Path to the firmware image file"
50+
type = string
51+
default = ""
52+
}
53+
54+
# Node 1 - Full provisioning
55+
resource "turingpi_node" "node1" {
56+
node = 1
57+
power_state = "on"
58+
firmware_file = var.firmware_path != "" ? var.firmware_path : null
59+
boot_check = true
60+
login_prompt_timeout = 120
61+
}
62+
63+
# Node 2 - Power on only
64+
resource "turingpi_node" "node2" {
65+
node = 2
66+
power_state = "on"
67+
boot_check = true
68+
}
69+
70+
# Node 3 - Keep powered off
71+
resource "turingpi_node" "node3" {
72+
node = 3
73+
power_state = "off"
74+
}
75+
76+
# Node 4 - Quick power on (no boot check)
77+
resource "turingpi_node" "node4" {
78+
node = 4
79+
power_state = "on"
80+
boot_check = false
81+
}
82+
83+
output "node_status" {
84+
value = {
85+
node1 = turingpi_node.node1.power_state
86+
node2 = turingpi_node.node2.power_state
87+
node3 = turingpi_node.node3.power_state
88+
node4 = turingpi_node.node4.power_state
89+
}
90+
}
91+
```
92+
93+
## Argument Reference
94+
95+
- `node` - (Required, Integer) The node ID (1-4).
96+
- `power_state` - (Optional, String) The desired power state. Valid values are `"on"` or `"off"`. Defaults to `"on"`.
97+
- `firmware_file` - (Optional, String) Path to the firmware image file. If specified, firmware will be flashed to the node.
98+
- `boot_check` - (Optional, Boolean) Whether to monitor UART output for login prompt to verify successful boot. Defaults to `false`.
99+
- `login_prompt_timeout` - (Optional, Integer) Timeout in seconds to wait for login prompt when `boot_check` is enabled. Defaults to `60`.
100+
101+
## Attribute Reference
102+
103+
In addition to all arguments above, the following attributes are exported:
104+
105+
- `id` - The resource identifier in the format `node-{node}`.
106+
107+
## Boot Verification
108+
109+
When `boot_check` is enabled, the provider monitors the node's UART output for a login prompt, indicating the operating system has successfully booted. This is useful for:
110+
111+
- Ensuring firmware flashing completed successfully
112+
- Waiting for nodes to be ready before dependent operations
113+
- Detecting boot failures
114+
115+
The `login_prompt_timeout` controls how long to wait for the boot to complete. Increase this value for slower compute modules or complex boot processes.
116+
117+
## Import
118+
119+
Node resources can be imported using the node ID:
120+
121+
```shell
122+
terraform import turingpi_node.node1 1
123+
```

docs/resources/power.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
page_title: "turingpi_power Resource - Turing Pi"
3+
subcategory: ""
4+
description: |-
5+
Controls the power state of a Turing Pi compute node.
6+
---
7+
8+
# turingpi_power (Resource)
9+
10+
Controls the power state of a Turing Pi compute node.
11+
12+
## Example Usage
13+
14+
```hcl
15+
# Power on node 1
16+
resource "turingpi_power" "node1" {
17+
node = 1
18+
state = true
19+
}
20+
21+
# Power off node 4
22+
resource "turingpi_power" "node4" {
23+
node = 4
24+
state = false
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
- `node` - (Required, Integer) The node ID (1-4).
31+
- `state` - (Required, Boolean) The desired power state. `true` for on, `false` for off.
32+
33+
## Attribute Reference
34+
35+
In addition to all arguments above, the following attributes are exported:
36+
37+
- `id` - The resource identifier in the format `power-{node}`.
38+
39+
## Import
40+
41+
Power resources can be imported using the node ID:
42+
43+
```shell
44+
terraform import turingpi_power.node1 1
45+
```

0 commit comments

Comments
 (0)