Terraform
Using the official Bahriya Terraform provider to manage your infrastructure as code.
19 articles
Installing the Terraform Provider
This guide covers installing Terraform, adding the Bahriya provider, authenticating, and keeping the provider up to date.
3 minTerraform Provider
The official Bahriya Terraform provider lets you manage your entire Bahriya infrastructure as code — projects, containers, 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). It is published on the HashiCorp Terraform Registry.
4 minComplete Terraform Example
This example brings together every Bahriya resource type in a single Terraform configuration: a project, private registry credentials, secrets, a Memcached cache, and an HTTP container wired up to all of them.
2 minDeploy a Cron Job with Terraform
A cron job runs your container on a schedule. It starts, runs to completion, and exits. Use it for nightly batches, periodic clean-ups, scheduled exports, or any workload that runs at a fixed cadence.
3 minDeploy a Project with Terraform
A project is the top-level grouping for your containers, secrets, registries, and Memcached instances. Every other resource belongs to a project.
3 minDeploy a Worker Container with Terraform
A worker container runs background processes — queue consumers, data pipelines, or anything that does not serve HTTP traffic. Workers have the same compute and scaling features as HTTP containers, but no public hostname, no ingress, and no traffic management.
2 minDeploy an HTTP Container with Terraform
HTTP containers are long-running services that accept incoming web traffic. Bahriya provisions a public hostname with TLS, runs health checks, and autoscales your container across one or more regions.
3 minDeploy Encryption Keys with Terraform
An encryption key stores a symmetric key (e.g. AES-256) in the Bahriya vault. Encryption keys are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers.
2 minDeploy Env Files with Terraform
An env file stores a KEY=VALUE configuration file in the Bahriya platform. Env files are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers — their entries are injected into the container as environment variables via envFrom.
2 minDeploy GPG Keypairs with Terraform
A GPG keypair stores an ASCII-armoured public key and private key pair. GPG keypairs are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers.
2 minDeploy JSON Configs with Terraform
A JSON config stores a validated JSON configuration file in the Bahriya platform. JSON configs are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers (mounted as files via a ConfigMap volume).
2 minDeploy Memcached with Terraform
Bahriya provides managed Memcached instances that run alongside your containers. Use them for session caching, query result caching, or any key-value workload that benefits from in-memory speed.
2 minDeploy Plain Configs with Terraform
A plain config stores an arbitrary text file in the Bahriya platform. Plain configs are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers (mounted as files inside the container).
2 minDeploy Registry Credentials with Terraform
A registry stores the credentials Bahriya needs to pull images from a private container registry (Docker Hub, GitHub Container Registry, GitLab, etc.). Registries are scoped to your organisation and referenced by handle when creating containers.
2 minDeploy Secrets with Terraform
A secret stores an encrypted value that you can mount as an environment variable in one or more containers. Secrets are encrypted at rest and only decrypted at deploy time inside the target region.
1 minDeploy SSH Keypairs with Terraform
An SSH keypair stores an SSH public key and its PEM-encoded private key. SSH keypairs are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers.
2 minDeploy TLS Bundles with Terraform
A TLS bundle stores a CA certificate, server certificate, and private key. TLS bundles are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers for secure communication.
2 minDeploy X.509 Certificates with Terraform
An X.509 certificate stores a single PEM-encoded certificate -- no private key, no CA. X.509 certificates are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers.
2 minDeploy YAML Configs with Terraform
A YAML config stores a validated YAML configuration file in the Bahriya platform. YAML configs are scoped to your organisation, versioned with rotation history, and can be attached to projects and containers.
1 min