43 lines
1.4 KiB
Markdown
43 lines
1.4 KiB
Markdown
# Example OpenTofu config for the hpe1810 provider
|
|
|
|
Run this once the switch is reachable again.
|
|
|
|
## 1. Build the provider
|
|
|
|
```bash
|
|
cd ../terraform-provider-hpe1810
|
|
go build -o terraform-provider-hpe1810 .
|
|
```
|
|
|
|
`~/.tofurc` already has a `dev_overrides` entry pointing at that directory, so `tofu`
|
|
picks up this locally-built binary instead of trying to fetch anything from a registry.
|
|
|
|
## 2. Plan
|
|
|
|
```bash
|
|
cd ../terraform # this directory
|
|
tofu plan
|
|
```
|
|
|
|
No `tofu init` needed (and it would fail anyway — `local/joachimfriberg/hpe1810` isn't a
|
|
real registry source) since `dev_overrides` bypasses that step entirely.
|
|
|
|
You'll see a warning about dev overrides being in effect — that's expected during local
|
|
development, not an error.
|
|
|
|
## Files here
|
|
|
|
- `versions.tf` — `required_providers` block, points at the provider source name.
|
|
- `provider.tf` — `provider "hpe1810"` block; all fields optional (see comments for the
|
|
env-var fallback chain).
|
|
- `main.tf` — the actual data source usage.
|
|
- `outputs.tf` — prints what came back.
|
|
|
|
## Remember
|
|
|
|
- Only one login session to the switch at a time (see AGENT.md) — close the switch's web
|
|
UI in your browser before running `tofu plan`.
|
|
- Same proxy issue as the Python project: Go's `net/http` also respects `HTTP_PROXY`/
|
|
`NO_PROXY`. If you get `login request returned status 502`, run
|
|
`export NO_PROXY=192.168.2.10` (or `no_proxy=192.168.2.10`) before `tofu plan`.
|