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

AttributeTypeRequiredDefaultDescription
namestringYes-Server name. DNS-compatible, lowercase alphanumeric with hyphens.
imagestringYes-OS image (e.g., ubuntu-24.04, debian-12, almalinux-9).
datacenterstringYes-Datacenter code: fsn1, nbg1, hel1, or ash.
resource_profilestringNonano_sharedResource profile. See profiles below.
cpu_allocation_typestringNosharedshared (3:1 overcommit) or dedicated.
auth_methodstringYes-ssh_key or password.
ssh_key_idstringConditional-Required if auth_method = "ssh_key".
passwordstringConditional-Required if auth_method = "password". Min 12 characters.
network_stackstringNodual_stackipv4_only, ipv6_only, or dual_stack.
cpu_coresnumberNo-Override CPU cores. Requires VPS to be stopped.
memory_size_gbnumberNo-Override memory in GB. Requires VPS to be stopped.
storage_size_gbnumberNo-Override storage in GB. Requires VPS to be stopped.
custom_cloud_initstringNo-Custom cloud-init configuration.

Resource Profiles

Shared CPU:

  • nano_shared: 1 vCPU, 1 GB RAM, 25 GB NVMe
  • micro_shared: 1 vCPU, 2 GB RAM, 40 GB NVMe
  • small_shared: 2 vCPU, 4 GB RAM, 80 GB NVMe
  • medium_shared: 4 vCPU, 8 GB RAM, 160 GB NVMe
  • large_shared: 8 vCPU, 16 GB RAM, 320 GB NVMe

Dedicated CPU:

  • nano_dedicated: 1 vCPU, 2 GB RAM, 25 GB NVMe
  • micro_dedicated: 2 vCPU, 4 GB RAM, 50 GB NVMe
  • small_dedicated: 4 vCPU, 8 GB RAM, 100 GB NVMe
  • medium_dedicated: 8 vCPU, 16 GB RAM, 200 GB NVMe
  • large_dedicated: 16 vCPU, 32 GB RAM, 400 GB NVMe

Available Images

  • ubuntu-24.04, ubuntu-22.04, ubuntu-20.04
  • debian-12, debian-11
  • almalinux-9, almalinux-8
  • rocky-9, rocky-8
  • fedora-40, fedora-39
  • alpine-3.20, alpine-3.19

Attribute Reference

AttributeTypeDescription
idstringVPS instance ID.
statusstringCurrent status (Running, Stopped, etc.).
public_ipstringPublic IPv4 address.
private_ipstringPrivate IP address.
ipv6_addressstringIPv6 address (if enabled).
monthly_costnumberMonthly cost in EUR.
monthly_cost_centsnumberMonthly cost in cents.
deployed_atstringDeployment timestamp.
created_atstringCreation timestamp.
updated_atstringLast 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

AttributeTypeRequiredDefaultDescription
namestringYes-Instance name. DNS-compatible, lowercase alphanumeric.
enginestringYes-Database engine: mysql, postgresql, or mariadb.
database_namestringNo-Initial database name. Max 64 characters.
resource_profilestringYes-Profile: small, medium, or large.
versionstringNo-Engine version (e.g., 16 for PostgreSQL).
datacenterstringYes-Datacenter code.
parameter_group_idstringNo-Custom parameter group ID.

Resource Profiles

ProfilevCPUMemoryStorage
small12 GB25 GB
medium24 GB50 GB
large48 GB100 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

AttributeTypeDescription
idstringDatabase instance ID.
statusstringCurrent status.
endpointstringConnection hostname.
portnumberConnection port.
usernamestringAdmin username.
storage_size_gbnumberStorage size in GB.
memory_size_mbnumberMemory in MB.
cpu_coresnumberNumber of CPU cores.
monthly_costnumberMonthly 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

AttributeTypeRequiredDefaultDescription
namestringYes-Instance name. Alphanumeric with hyphens.
cache_providerstringYes-Provider: redis, valkey, or dragonfly.
resource_profilestringYes-Profile: micro, small, medium, or large.
memory_size_mbnumberNo-Override memory size in MB.
cpu_coresnumberNo-Override CPU cores.
versionstringNo-Provider version.
datacenterstringYes-Datacenter code.
parameter_group_idstringNo-Custom parameter group ID.

Resource Profiles

ProfileMemoryvCPU
micro256 MB0.5
small512 MB1
medium1 GB2
large2 GB4

Cache Providers

  • Redis: Industry-standard in-memory data store
  • Valkey: Redis-compatible, community-driven fork
  • Dragonfly: Multi-threaded, high-performance cache

Attribute Reference

AttributeTypeDescription
idstringCache instance ID.
statusstringCurrent status.
endpointstringConnection hostname.
portnumberConnection port (usually 6379).
monthly_costnumberMonthly 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

AttributeTypeRequiredDefaultDescription
namestringYes-Bucket name. S3-compatible (3-63 chars, lowercase).
display_namestringNo-Human-readable display name.
regionstringYes-Region (currently fsn1).
public_accessboolNofalseEnable public read access.
versioning_enabledboolNofalseEnable object versioning.
encryption_enabledboolNotrueEnable server-side encryption.
encryption_typestringNosse-s3none, sse-s3, or sse-kms.

Attribute Reference

AttributeTypeDescription
idstringBucket ID.
statusstringCurrent status.
endpoint_urlstringS3 endpoint URL.
minio_bucket_namestringInternal bucket name.
size_bytesnumberTotal size in bytes.
object_countnumberNumber of objects.
monthly_costnumberMonthly 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

AttributeTypeRequiredDefaultDescription
namestringYes-Access key name (1-255 chars).
expires_atstringNo-Expiration date (ISO 8601 format).

Attribute Reference

AttributeTypeDescription
idstringAccess key ID (internal).
access_key_idstringS3 access key ID.
secret_access_keystringS3 secret access key (sensitive).
statusstringCurrent 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

AttributeTypeRequiredDefaultDescription
namestringYes-Key name.
public_keystringYes-OpenSSH format public key (ssh-rsa or ssh-ed25519).

Attribute Reference

AttributeTypeDescription
idstringSSH key ID.
fingerprintstringSHA256 fingerprint.
created_atstringCreation timestamp.
updated_atstringLast 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

AttributeTypeRequiredDefaultDescription
namestringYes-Service name.
resource_profilestringNosmallProfile: small, medium, or large.
deployment_typestringYes-image (Docker) or git.
image_urlstringConditional-Docker image URL. Required if deployment_type = "image".
git_repositorystringConditional-Git repo URL. Required if deployment_type = "git".
git_branchstringNomainGit branch to deploy.
portnumberNo8080Container port (1-65535).
min_instancesnumberNo0Minimum instances. 0 enables scale-to-zero.
max_instancesnumberNo5Maximum instances (1-100).
environment_variablesmapNo-Environment variables for the container.

Resource Profiles

ProfilevCPUMemory
small0.5512 MB
medium11 GB
large22 GB

Attribute Reference

AttributeTypeDescription
idstringServerless service ID.
statusstringCurrent status.
urlstringPublic URL.
current_month_cost_centsnumberCurrent 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

AttributeTypeRequiredDefaultDescription
namestringYes-Firewall name.
descriptionstringNo-Description.
is_defaultboolNofalseMark as default firewall for team.
default_actionstringNodropDefault action: drop or accept.
ruleslistNo-List of firewall rules.

Rule Arguments

AttributeTypeRequiredDescription
namestringYesRule name.
actionstringYesallow or deny.
directionstringYesinbound or outbound.
protocolstringYestcp, udp, or icmp.
port_range_startnumberNoStart port (1-65535).
port_range_endnumberNoEnd port (1-65535).
source_ipslistNoList of source CIDR blocks.
prioritynumberYesRule priority (lower = higher priority).

Attribute Reference

AttributeTypeDescription
idstringFirewall ID.
statusstringCurrent 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

AttributeTypeRequiredDefaultDescription
namestringYes-Snapshot name.
descriptionstringNo-Snapshot description.
vps_instance_idstringYes-ID of the VPS instance to snapshot.

Attribute Reference

AttributeTypeDescription
idstringSnapshot ID.
statusstringCurrent status.
size_gbnumberSnapshot size in GB.
created_atstringCreation timestamp.
updated_atstringLast 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