Terraform Resources
This page documents all resources available in the DanubeData Terraform provider.
danubedata_vps
Manages a Virtual Private Server (VPS) instance.
Example Usage
HCL
resource "danubedata_ssh_key" "main" {
name = "my-key"
public_key = file("~/.ssh/id_ed25519.pub")
}
resource "danubedata_vps" "web" {
name = "web-server"
image = "ubuntu-24.04"
datacenter = "fsn1"
resource_profile = "small_shared"
auth_method = "ssh_key"
ssh_key_id = danubedata_ssh_key.main.id
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Server name. DNS-compatible, lowercase alphanumeric with hyphens. |
image | string | Yes | - | OS image (e.g., ubuntu-24.04, debian-12, almalinux-9). |
datacenter | string | Yes | - | Datacenter code: fsn1, nbg1, hel1, or ash. |
resource_profile | string | No | nano_shared | Resource profile. See profiles below. |
cpu_allocation_type | string | No | shared | shared (3:1 overcommit) or dedicated. |
auth_method | string | Yes | - | ssh_key or password. |
ssh_key_id | string | Conditional | - | Required if auth_method = "ssh_key". |
password | string | Conditional | - | Required if auth_method = "password". Min 12 characters. |
network_stack | string | No | dual_stack | ipv4_only, ipv6_only, or dual_stack. |
cpu_cores | number | No | - | Override CPU cores. Requires VPS to be stopped. |
memory_size_gb | number | No | - | Override memory in GB. Requires VPS to be stopped. |
storage_size_gb | number | No | - | Override storage in GB. Requires VPS to be stopped. |
custom_cloud_init | string | No | - | Custom cloud-init configuration. |
Resource Profiles
Shared CPU:
nano_shared: 1 vCPU, 1 GB RAM, 25 GB NVMemicro_shared: 1 vCPU, 2 GB RAM, 40 GB NVMesmall_shared: 2 vCPU, 4 GB RAM, 80 GB NVMemedium_shared: 4 vCPU, 8 GB RAM, 160 GB NVMelarge_shared: 8 vCPU, 16 GB RAM, 320 GB NVMe
Dedicated CPU:
nano_dedicated: 1 vCPU, 2 GB RAM, 25 GB NVMemicro_dedicated: 2 vCPU, 4 GB RAM, 50 GB NVMesmall_dedicated: 4 vCPU, 8 GB RAM, 100 GB NVMemedium_dedicated: 8 vCPU, 16 GB RAM, 200 GB NVMelarge_dedicated: 16 vCPU, 32 GB RAM, 400 GB NVMe
Available Images
ubuntu-24.04,ubuntu-22.04,ubuntu-20.04debian-12,debian-11almalinux-9,almalinux-8rocky-9,rocky-8fedora-40,fedora-39alpine-3.20,alpine-3.19
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | VPS instance ID. |
status | string | Current status (Running, Stopped, etc.). |
public_ip | string | Public IPv4 address. |
private_ip | string | Private IP address. |
ipv6_address | string | IPv6 address (if enabled). |
monthly_cost | number | Monthly cost in EUR. |
monthly_cost_cents | number | Monthly cost in cents. |
deployed_at | string | Deployment timestamp. |
created_at | string | Creation timestamp. |
updated_at | string | Last update timestamp. |
Import
Bash
terraform import danubedata_vps.web 12345
danubedata_database
Manages a managed database instance.
Example Usage
HCL
resource "danubedata_database" "main" {
name = "production-db"
database_name = "myapp"
engine = "postgresql"
version = "16"
resource_profile = "medium"
datacenter = "fsn1"
}
output "connection_string" {
value = "postgresql://${danubedata_database.main.username}@${danubedata_database.main.endpoint}:${danubedata_database.main.port}/${danubedata_database.main.database_name}"
sensitive = true
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Instance name. DNS-compatible, lowercase alphanumeric. |
engine | string | Yes | - | Database engine: mysql, postgresql, or mariadb. |
database_name | string | No | - | Initial database name. Max 64 characters. |
resource_profile | string | Yes | - | Profile: small, medium, or large. |
version | string | No | - | Engine version (e.g., 16 for PostgreSQL). |
datacenter | string | Yes | - | Datacenter code. |
parameter_group_id | string | No | - | Custom parameter group ID. |
Resource Profiles
| Profile | vCPU | Memory | Storage |
|---|---|---|---|
small | 1 | 2 GB | 25 GB |
medium | 2 | 4 GB | 50 GB |
large | 4 | 8 GB | 100 GB |
Supported Versions
- PostgreSQL: 15, 16, 17
- MySQL: 8.0, 8.4, 9.0, 9.1
- MariaDB: 10.11, 11.4, 11.6
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | Database instance ID. |
status | string | Current status. |
endpoint | string | Connection hostname. |
port | number | Connection port. |
username | string | Admin username. |
storage_size_gb | number | Storage size in GB. |
memory_size_mb | number | Memory in MB. |
cpu_cores | number | Number of CPU cores. |
monthly_cost | number | Monthly cost in EUR. |
Import
Bash
terraform import danubedata_database.main 67890
danubedata_cache
Manages an in-memory cache instance.
Example Usage
HCL
resource "danubedata_cache" "redis" {
name = "app-cache"
cache_provider = "redis"
resource_profile = "small"
datacenter = "fsn1"
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Instance name. Alphanumeric with hyphens. |
cache_provider | string | Yes | - | Provider: redis, valkey, or dragonfly. |
resource_profile | string | Yes | - | Profile: micro, small, medium, or large. |
memory_size_mb | number | No | - | Override memory size in MB. |
cpu_cores | number | No | - | Override CPU cores. |
version | string | No | - | Provider version. |
datacenter | string | Yes | - | Datacenter code. |
parameter_group_id | string | No | - | Custom parameter group ID. |
Resource Profiles
| Profile | Memory | vCPU |
|---|---|---|
micro | 256 MB | 0.5 |
small | 512 MB | 1 |
medium | 1 GB | 2 |
large | 2 GB | 4 |
Cache Providers
- Redis: Industry-standard in-memory data store
- Valkey: Redis-compatible, community-driven fork
- Dragonfly: Multi-threaded, high-performance cache
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | Cache instance ID. |
status | string | Current status. |
endpoint | string | Connection hostname. |
port | number | Connection port (usually 6379). |
monthly_cost | number | Monthly cost in EUR. |
Import
Bash
terraform import danubedata_cache.redis 11111
danubedata_storage_bucket
Manages an S3-compatible object storage bucket.
Example Usage
HCL
resource "danubedata_storage_bucket" "assets" {
name = "my-app-assets"
display_name = "Application Assets"
region = "fsn1"
versioning_enabled = true
encryption_enabled = true
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Bucket name. S3-compatible (3-63 chars, lowercase). |
display_name | string | No | - | Human-readable display name. |
region | string | Yes | - | Region (currently fsn1). |
public_access | bool | No | false | Enable public read access. |
versioning_enabled | bool | No | false | Enable object versioning. |
encryption_enabled | bool | No | true | Enable server-side encryption. |
encryption_type | string | No | sse-s3 | none, sse-s3, or sse-kms. |
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | Bucket ID. |
status | string | Current status. |
endpoint_url | string | S3 endpoint URL. |
minio_bucket_name | string | Internal bucket name. |
size_bytes | number | Total size in bytes. |
object_count | number | Number of objects. |
monthly_cost | number | Monthly cost in EUR. |
Import
Bash
terraform import danubedata_storage_bucket.assets abc123
danubedata_storage_access_key
Manages S3 access keys for object storage.
Example Usage
HCL
resource "danubedata_storage_access_key" "app" {
name = "app-storage-key"
}
output "access_key_id" {
value = danubedata_storage_access_key.app.access_key_id
}
output "secret_access_key" {
value = danubedata_storage_access_key.app.secret_access_key
sensitive = true
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Access key name (1-255 chars). |
expires_at | string | No | - | Expiration date (ISO 8601 format). |
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | Access key ID (internal). |
access_key_id | string | S3 access key ID. |
secret_access_key | string | S3 secret access key (sensitive). |
status | string | Current status. |
Import
Bash
terraform import danubedata_storage_access_key.app key123
danubedata_ssh_key
Manages SSH keys for VPS authentication.
Example Usage
HCL
resource "danubedata_ssh_key" "deploy" {
name = "deploy-key"
public_key = file("~/.ssh/id_ed25519.pub")
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Key name. |
public_key | string | Yes | - | OpenSSH format public key (ssh-rsa or ssh-ed25519). |
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | SSH key ID. |
fingerprint | string | SHA256 fingerprint. |
created_at | string | Creation timestamp. |
updated_at | string | Last update timestamp. |
Import
Bash
terraform import danubedata_ssh_key.deploy 22222
danubedata_serverless
Manages Knative-based serverless containers.
Example Usage
HCL
resource "danubedata_serverless" "api" {
name = "my-api"
deployment_type = "image"
image_url = "ghcr.io/myorg/my-api:latest"
resource_profile = "small"
port = 8080
min_instances = 0
max_instances = 10
environment_variables = {
NODE_ENV = "production"
LOG_LEVEL = "info"
}
}
output "api_url" {
value = danubedata_serverless.api.url
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Service name. |
resource_profile | string | No | small | Profile: small, medium, or large. |
deployment_type | string | Yes | - | image (Docker) or git. |
image_url | string | Conditional | - | Docker image URL. Required if deployment_type = "image". |
git_repository | string | Conditional | - | Git repo URL. Required if deployment_type = "git". |
git_branch | string | No | main | Git branch to deploy. |
port | number | No | 8080 | Container port (1-65535). |
min_instances | number | No | 0 | Minimum instances. 0 enables scale-to-zero. |
max_instances | number | No | 5 | Maximum instances (1-100). |
environment_variables | map | No | - | Environment variables for the container. |
Resource Profiles
| Profile | vCPU | Memory |
|---|---|---|
small | 0.5 | 512 MB |
medium | 1 | 1 GB |
large | 2 | 2 GB |
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | Serverless service ID. |
status | string | Current status. |
url | string | Public URL. |
current_month_cost_cents | number | Current month cost in cents. |
Import
Bash
terraform import danubedata_serverless.api 33333
danubedata_firewall
Manages firewall rules for network security.
Example Usage
HCL
resource "danubedata_firewall" "web" {
name = "web-firewall"
description = "Firewall for web servers"
default_action = "drop"
rules {
name = "allow-ssh"
action = "allow"
direction = "inbound"
protocol = "tcp"
port_range_start = 22
port_range_end = 22
source_ips = ["0.0.0.0/0"]
priority = 100
}
rules {
name = "allow-http"
action = "allow"
direction = "inbound"
protocol = "tcp"
port_range_start = 80
port_range_end = 80
source_ips = ["0.0.0.0/0"]
priority = 200
}
rules {
name = "allow-https"
action = "allow"
direction = "inbound"
protocol = "tcp"
port_range_start = 443
port_range_end = 443
source_ips = ["0.0.0.0/0"]
priority = 300
}
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Firewall name. |
description | string | No | - | Description. |
is_default | bool | No | false | Mark as default firewall for team. |
default_action | string | No | drop | Default action: drop or accept. |
rules | list | No | - | List of firewall rules. |
Rule Arguments
| Attribute | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Rule name. |
action | string | Yes | allow or deny. |
direction | string | Yes | inbound or outbound. |
protocol | string | Yes | tcp, udp, or icmp. |
port_range_start | number | No | Start port (1-65535). |
port_range_end | number | No | End port (1-65535). |
source_ips | list | No | List of source CIDR blocks. |
priority | number | Yes | Rule priority (lower = higher priority). |
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | Firewall ID. |
status | string | Current status. |
Import
Bash
terraform import danubedata_firewall.web 44444
danubedata_vps_snapshot
Manages point-in-time snapshots of VPS instances.
Example Usage
HCL
resource "danubedata_vps_snapshot" "backup" {
name = "pre-upgrade-backup"
description = "Snapshot before major upgrade"
vps_instance_id = danubedata_vps.web.id
}
Argument Reference
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Snapshot name. |
description | string | No | - | Snapshot description. |
vps_instance_id | string | Yes | - | ID of the VPS instance to snapshot. |
Attribute Reference
| Attribute | Type | Description |
|---|---|---|
id | string | Snapshot ID. |
status | string | Current status. |
size_gb | number | Snapshot size in GB. |
created_at | string | Creation timestamp. |
updated_at | string | Last update timestamp. |
Import
Bash
terraform import danubedata_vps_snapshot.backup 55555
Timeouts
All resources support configurable timeouts:
HCL
resource "danubedata_vps" "app" {
# ...
timeouts {
create = "10m"
update = "10m"
delete = "5m"
}
}
Next Steps
- Terraform Data Sources - Query existing resources
- Terraform Examples - Real-world examples
- Terraform Overview - Getting started guide