terraform apply against your Barndoor organization.
Estimated time: 10–15 minutes
Before You Begin
You’ll need:- A Barndoor account with admin privileges for your organization
- Terraform 1.0 or later (OpenTofu works too)
Step 1: Generate a provider credential
The provider authenticates as a machine credential scoped to your organization — no interactive login, no user tokens.- In the Barndoor app, go to Settings → API Tokens.
- Find the Terraform provider credentials panel and click Generate credential.
- Choose a secret expiry (90 days by default; you can rotate at any time).
- Copy the three values from the reveal dialog: Client ID, Client secret, and Organization ID. The dialog also offers a ready-made Terraform configuration you can copy directly.
One credential is active per organization. Rotating replaces the secret in place; revoking disables the credential entirely. If your team already uses Terraform with Barndoor, coordinate before rotating — a rotation invalidates the secret everyone else is using.
Step 2: Configure the provider
Create a working directory with amain.tf:
main.tf
All five values are required — the provider fails with a clear error naming any that are missing.
Step 3: Write your first resource
We’ll create a data-protection allow-list entry — it has no dependencies, changes no runtime behavior beyond suppressing findings for one harmless literal, and is fully deleted on destroy. Add tomain.tf:
main.tf
barndoor_dlp_allow_list_entry
Step 4: Init, plan, apply
Step 5: Verify
Two quick checks that everything is wired correctly:- Run
terraform planagain — it should reportNo changes, confirming that what Terraform created matches what the platform stored. - In the Barndoor app, open Data Control Center and find the allow-list entry you just created.
Step 6: Clean up
Next Steps
Manage MCP Access
Onboard an MCP server, connect it, and govern which AI Agents can use it.
Manage the LLM Gateway
Providers, model routing, access policies, rate limits, and budgets.
Manage Data Protection
Detection types, allow lists, and enforcement policies.
Best Practices
Importing, drift, CI/CD, and troubleshooting.
Troubleshooting
Token request failed: invalid_client
Token request failed: invalid_client
The
client_id / client_secret pair was rejected by the token endpoint. Confirm you exported BARNDOOR_CLIENT_SECRET in the shell running Terraform, and that the credential hasn’t been rotated (rotation invalidates the old secret) or revoked.403 errors mentioning the organization admin role
403 errors mentioning the organization admin role
The credential exists but isn’t authorized for the operation. This usually means
organization_id doesn’t match the organization the credential was generated in — copy it from the credential panel in Settings → API Tokens rather than from elsewhere.base_url must be the platform host root
base_url must be the platform host root
The provider rejects a
base_url with a path suffix (for example a trailing /api). Use the bare origin, e.g. https://platform.barndoor.ai.The provider block validates but apply hangs or times out
The provider block validates but apply hangs or times out
Check that
base_url and token_url are reachable from the machine running Terraform — corporate proxies and VPNs are the usual cause. The provider uses plain HTTPS with a 30-second timeout per request.