Resource
bahriya_project
The namespace that groups containers, secrets, registries, and cache instances. Define regions, and let the platform manage namespace quotas.
The official Bahriya provider for HashiCorp Terraform. Define projects, containers, secrets, registries, Memcached, vault items, and config items in .tf files, review changes in pull requests, and apply them from a pipeline — alongside the rest of your infrastructure.
Install the provider with terraform init— no manual downloads, no local builds. The provider is published on the HashiCorp Terraform Registry with cross-platform binaries for Linux, macOS, Windows, and FreeBSD on AMD64 and ARM64.
Every resource type on the platform is supported: projects, HTTP containers, workers, cron jobs, registries, secrets, Memcached, vault items (TLS bundles, X.509 certs, GPG and SSH keypairs, encryption keys), and config items (env files, YAML / JSON / plain text). Three data sources round it out — query your organisation, look up a region, or list all regions with a status filter.
Bahriya resources sit alongside your DNS provider, monitoring, CI/CD, and anything else you manage with Terraform. One plan, one apply, one state file. No context-switching between tools.
Set BAHRIYA_TOKEN and BAHRIYA_ORGANISATION_ID as pipeline secrets. Run terraform plan on pull requests and terraform applyon merge — no interactive prompts, no manual steps.
Resources
Every resource type on the platform — with create, read, update, delete, and import. Three data sources for dynamic lookups.
Resource
The namespace that groups containers, secrets, registries, and cache instances. Define regions, and let the platform manage namespace quotas.
Resource
HTTP services, background workers, and scheduled cron jobs. Supports autoscaling, environment variables, secrets, custom hostnames, rate limiting, basic auth, Prometheus scraping, proxy caching, init jobs, and persistent volumes.
Resource
Managed Memcached instances with configurable memory, node count, cluster mode, connection limits, and item size. Accessible within your project on port 11211.
Resource
Credentials for pulling images from private container registries — GitHub, Docker Hub, AWS ECR, or any OCI-compatible registry.
Resource
Encrypted values injected into containers as environment variables. Secrets are encrypted at rest and never returned in plaintext by the API.
Resources
TLS bundles, X.509 certs, GPG keypairs, SSH keypairs, and encryption keys. Versioned with rotation history; mount into containers as files or attach to projects to share across regions.
Resources
Env files (injected as env vars), YAML, JSON, and plain text configs (mounted as files). Update content in your .tf, run apply, and file-mounted containers pick up the new version automatically.
Resource
bahriya_project_*_attachmentresources bind a vault or config item to a project, making it available in the project's regions. Detach with one line — the API blocks detach if a container still references the item.
Data sources
Look up your current organisation, query a region by ID, or list all active regions. Use the regions data source to dynamically select deployment targets.
Getting started
Add the provider, set two environment variables, and start defining resources.
terraform {
required_providers {
bahriya = {
source = "bahriya-cloud/bahriya"
version = "~> 0.1"
}
}
}
provider "bahriya" {}
$ export BAHRIYA_TOKEN="pat_..."
$ export BAHRIYA_ORGANISATION_ID="..."
$ terraform init
resource "bahriya_project" "web" {
handle = "web-prod"
name = "Web Production"
regions = ["falkenstein-1"]
}
resource "bahriya_container" "api" {
handle = "api"
name = "API Server"
image = "nginx:alpine"
containerport = "80"
healthcheckpath = "/"
mincpu = "100"
minmemory = "128"
autoscalingminreplicas = "1"
activeregions = ["falkenstein-1"]
project = bahriya_project.web.id
}
Workflow
Terraform's plan/apply cycle shows you exactly what will be created, updated, or destroyed — before anything changes.
$ terraform plan
Terraform will perform the following actions:
# bahriya_project.web will be created
+ resource "bahriya_project" "web" {
+ handle = "web-prod"
+ name = "Web Production"
+ regions = ["falkenstein-1"]
}
# bahriya_container.api will be created
+ resource "bahriya_container" "api" {
+ handle = "api"
+ image = "nginx:alpine"
+ containerport = "80"
+ status = (known after apply)
}
Plan: 2 to add, 0 to change, 0 to destroy.
$ terraform apply
bahriya_project.web: Creating...
bahriya_project.web: Creation complete [id=065df92e-...]
bahriya_container.api: Creating...
bahriya_container.api: Still creating... [2m0s elapsed]
bahriya_container.api: Creation complete [id=17a3c8b1-...]
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Commit your .tf files alongside application code. Review infrastructure changes in pull requests with the same process you use for code.
Spin up identical staging and production environments from the same configuration. No drift, no manual steps, no surprises.
Manage Bahriya resources alongside DNS, monitoring, CI/CD, and other cloud providers in a single Terraform workspace.
Already running on Bahriya? Import your existing projects, containers, and secrets into Terraform state without recreating them.
Documentation
Installation guides, per-resource examples, field references, and a complete working configuration covering every resource type.
Install the Bahriya Terraform provider and start managing your infrastructure declaratively.