How vmvarela/oras-state works
oras-state is a Go library that lets Terraform/OpenTofu adapters store and manage workspace state in OCI registries. The main workflow is to create a configured client, read or publish a workspace’s state, and optionally coordinate updates with cooperative locks; publication can also maintain version history. Separate capabilities cover workspace discovery and deletion, repository copying, and registry cleanup. The excerpts show client construction, state publication, workspace checks, history reads, copying, and cleanup logic; unsampled client methods are grouped by responsibility rather than assumed call flow.
Main entry points: auth.go Client setup · client.go Current state I/O · history.go Version history · copy.go Repository copy
Components 13
Client and workspaces
- Client setup
auth.go - Workspace validation
workspace.go - Legacy layout
legacy_layout.go
State and history
- Current state I/O
client.go - Workspace locks
client.go - Version history
history.go
Repository maintenance
- Workspace deletion
client.go - Repository copy
copy.go - Registry purge
purge.go
Registry integrations
- GHCR deletion fallback
ghcr.go
Other components
- Go adapter
- OCI registry
- GitHub Packages API
Connections 15
- Go adapter → Client setup: creates client
auth.go - Client setup → OCI registry: configures access
auth.go - Go adapter → Current state I/O: reads or writes
README.md - Current state I/O → Workspace validation: checks workspace
client.go - Go adapter → Workspace locks: coordinates updates
README.md - Go adapter → Version history: reads versions
README.md - Version history → Workspace validation: checks workspace
history.go - Go adapter → Workspace deletion: deletes workspace
README.md - Go adapter → Repository copy: copies repository
copy.go - Repository copy → OCI registry: copies artifacts
copy.go - Go adapter → Registry purge: purges artifacts
purge.go - Registry purge → OCI registry: inventories artifacts
purge.go - GHCR deletion fallback → GitHub Packages API: deletes versions
ghcr.go - Workspace deletion → GHCR deletion fallback: uses fallback
client.go - Legacy layout → OCI registry: resolves legacy tags
legacy_layout.go