Deploy 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).
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).
Use a plain config when the content isn't structured (YAML / JSON / env-file) but you still want it managed declaratively — .htaccess files, nginx snippets, prompts, license text, anything text.
Required fields
| Field | Type | Description |
|---|---|---|
handle | string | A unique identifier (DNS-1123 compliant: lowercase, alphanumeric, hyphens). |
name | string | A display name. |
content | string | Arbitrary text. |
Read-only fields
| Field | Type | Description |
|---|---|---|
contentlength | integer | Length of content in bytes. |
currentversion | integer | The currently active version number. |
maxversions | integer | How many historic versions are retained (default 5). |
Example
resource "bahriya_plain_config" "nginx_snippet" {
handle = "nginx-snippet"
name = "Nginx Snippet"
content = file("${path.module}/configs/snippet.conf")
}Attach it to a project so it deploys to the project's regions:
resource "bahriya_project" "production" {
handle = "production"
name = "Production"
regions = ["helsinki-1", "falkenstein-1"]
}
resource "bahriya_project_plain_config_attachment" "nginx_snippet" {
project_id = bahriya_project.production.id
handle = bahriya_plain_config.nginx_snippet.handle
}Then mount it on a container as a file via a ConfigMap volume:
resource "bahriya_container" "web" {
# ... other fields ...
plain_configs = [
{
handle = bahriya_plain_config.nginx_snippet.handle
mountpath = "/etc/nginx/conf.d/snippet.conf"
},
]
}Rotation
To rotate the content, update the content field in your Terraform config and run terraform apply. The Bahriya API creates a new version and marks it current. Previous versions are retained for rollback.
File-mounted plain configs pick up updates within about 60 seconds. No manual redeploy is needed.
Importing an existing config
terraform import bahriya_plain_config.nginx_snippet <uuid>Pricing
Plain configs are billed at $0.02 per month while they exist in your organisation, plus $0.02 per region per month when attached to a project.