Terraform
The Terraform provider manages the building and the rules as code: sites, areas, doors and access points, groups and the roles they hold, identity providers and connectors. It uses the same API as everything else, so what it does shows up in the event log like any other change.
The provider isn't on the Terraform Registry yet. Contact Passway to get it for your organization.
Configure the provider
The provider signs in as an API client with the client credentials grant, caching and refreshing its tokens. Give the client the scopes for the resources you'll manage, such as sites:write and doors:write.
main.tf
terraform {
required_providers {
passway = {
source = "teampassway/passway"
}
}
}
# Or set PASSWAY_ENDPOINT, PASSWAY_CLIENT_ID and PASSWAY_CLIENT_SECRET.
provider "passway" {
endpoint = "https://acme.ext.passway.com"
}
A door, end to end
hq.tf
resource "passway_site" "hq" {
name = "HQ"
time_zone = "America/New_York"
}
resource "passway_area" "lab" {
site_id = passway_site.hq.id
name = "Lab 3"
}
resource "passway_door" "lab" {
site_id = passway_site.hq.id
name = "Lab 3 door"
}
resource "passway_access_point" "lab_in" {
site_id = passway_site.hq.id
name = "Into Lab 3"
door_id = passway_door.lab.id
area_to_id = passway_area.lab.id
}
Groups that keep themselves
A group can follow what the directory says about people, and limit who may add others by hand:
groups.tf
# The break-glass group: always admin, for when the identity provider is down.
resource "passway_group" "break_glass" {
name = "break-glass"
break_glass = true
}
# Everyone in engineering in New York, as the directory says. Others join
# only with someone else's approval, for at most two weeks.
resource "passway_group" "ny_engineering" {
name = "ny-engineering"
membership_rule = {
conditions = [
{ attribute = "department", operator = "in", values = ["Engineering"] },
{ attribute = "location", operator = "in", values = ["New York"] },
]
}
manual_members = "approval"
max_manual_days = 14
approver_group_id = passway_group.break_glass.id
}
resource "passway_role_assignment" "security" {
role_id = "role_security"
group_id = passway_group.ny_engineering.id
}
Resources
| Resource | Is |
|---|---|
passway_site | A building or campus (IFC IfcSite). |
passway_area | A building, floor, room or other space. Areas nest. |
passway_door | A barrier with a lock, and its timings (ONVIF Door). |
passway_access_point | One controlled way from one area into another (ONVIF AccessPoint). |
passway_identity_provider | An OpenID Connect provider people sign in with: Okta, Entra ID, Google or Passway ID. |
passway_person | Someone no directory knows about: a break-glass administrator, a visitor or a contractor. |
passway_group | A group managed in Passway, by hand or by a membership rule. |
passway_group_member | Someone added to a group by hand, optionally until valid_to. |
passway_role_assignment | A role (role_admin, role_security, role_viewer or your own) given to a group. |
passway_connector | Where people and groups come from: a SCIM endpoint or Google Workspace. See Directory sync. |
People and groups from a directory belong to it, so manage only the ones Passway creates here.
How it behaves
- No lost updates. Every update and delete sends the
etagfrom the last refresh asIf-Match. If someone changed the resource in the dashboard in between, the apply stops and asks you to run it again, instead of overwriting their change. - Drift is put back. A change made elsewhere shows up in the next plan, and apply restores the configuration.
- Safe retries. Creates send an
Idempotency-Key, so a retry after a network error can't create a second site. Rate limits and503s are retried with backoff. - Errors point at the line. Validation errors carry a JSON Pointer, which the provider turns into the attribute that's wrong.
- Ownership is visible. What the provider creates has
managed_by = "terraform", so the dashboard warns before anyone edits it. - Import by ID.
terraform import passway_door.lab door_…. A group member imports asgrp_…/per_….