Docs/statusharbor_lighthouse resource

statusharbor_lighthouse resource

Creates a Lighthouse and mints its agent token.

Example

resource "statusharbor_lighthouse" "prod" {
  name                = "prod-vpc"
  notify_on_lifecycle = true
}
 
output "agent_token" {
  value     = statusharbor_lighthouse.prod.token
  sensitive = true
}

Schema

Arguments

NameTypeRequiredNotes
namestringUnique per team. Renaming via Terraform is not supported — see Updates.
hoststringOptional hostname hint shown in the dashboard until the agent registers. Once the agent calls in, it reports its own hostname and the server overwrites this value, so any Terraform-managed setting drifts after first heartbeat.
notify_on_lifecycleboolPage the team on lighthouse.online / lighthouse.offline. Server default false.
flap_protection_thresholdintConsecutive same-state results required before transition. Server default 1 (no flap protection — every state change reported immediately).
pausedboolWhen true, the agent runs no checks. Server default false.

Computed attributes

NameNotes
idUUID assigned by the server.
tokenSensitive. Bearer token returned only on create; persists in state.
agent_hostnameHostname the agent reported on its last heartbeat. Read-only.
agent_versionAgent binary version on its last heartbeat.
last_heartbeat_atRFC3339 timestamp; empty until the agent connects.
created_at / updated_atRFC3339 timestamps.

Updates

host, paused, notify_on_lifecycle and flap_protection_threshold update in place via PATCH.

Renaming (name) is not supported — the Status Harbor API doesn't expose rename via PATCH. Editing name in HCL and running terraform apply returns an error rather than recreating the resource. If you need to rename, change it in the Console UI and re-run terraform import to refresh state.

Import

terraform import statusharbor_lighthouse.prod <uuid>

The UUID is in the dashboard URL: /lighthouses/<uuid>. The agent's bearer token cannot be recovered on import — the API doesn't echo it on read. If your workflow needs a token in state, either keep the original deployment that created it, or terraform apply -replace=statusharbor_lighthouse.<name> to destroy + recreate with a new token.

End-to-end

The resource only mints the record — to deploy the agent itself, pair it with one of the deployment modules:

module "lighthouse" {
  source = "github.com/statusharbor/terraform-lighthouse//modules/helm?ref=v0.1.0"
 
  token     = statusharbor_lighthouse.prod.token
  namespace = "status-harbor"
}