IaC Bazaar
UpCloudStatic-verified

UpCloud Managed Database

Managed PG/MySQL with properties tuning, users, and logical DBs.

terraformAlt & Specialty Clouds#upcloud

Compare Managed Relational Database across clouds →

upcloud-managed-databaseterraform v1.7

Verification

Static-verified

Passed: validated and lint-clean (provider-schema-validated for AWS/Azure/GCP; Terraform-language lint elsewhere).

Conformance

  • Static validation (fmt · validate · tflint)
  • No applicable security policies for this provider
  • Plan tests (mocked: validation rules · outputs)

Provenance

  • SHA-256 checksum
  • Signature (pending)

Functional

  • Live test pending (no cloud run yet)

Last verified 2026-06-28 · how we verify

Documentation

upcloud-managed-database

A hardened UpCloud Managed PostgreSQL service: private-by-default endpoint with a deny-all IP filter, managed encrypted storage, termination protection, a daily backup window, common tuning properties, and declaratively-managed additional users and logical databases. Works with Terraform and OpenTofu (>= 1.6), UpCloud provider >= 5.0, < 6.0. EU/Nordic-sovereign infrastructure, MIT-licensed provider.

Status: static-validated, live-test pending. Validated with tofu validate + tflint + checkov against the UpCloudLtd/upcloud provider. Not yet applied against a live UpCloud account (no cloud sandbox yet; a managed service takes several minutes to provision), so it ships under live-test quarantine.

Design & secure defaults

  • Not publicly exposed. public_access = false by default. The inbound ip_filter defaults to empty = deny all external sources; connect over the SDN private network or the utility-network allow list. A precondition refuses public_access = true unless you also supply an ip_filter, so you can never open the database to all of the internet by accident.
  • Encryption + TLS are intrinsic to UpCloud Managed Databases (storage encrypted at rest; connections require TLS — see the sslmode output).
  • Termination protection on by default — destroying the service is blocked until you flip the flag.
  • Daily managed backups at a configurable UTC backup_hour / backup_minute.
  • Per-engine resource model. This module uses the engine-specific upcloud_managed_database_postgresql (not a generic resource), plus upcloud_managed_database_user and upcloud_managed_database_logical_database.
  • Secret hygiene. Users are keyed by username (non-sensitive for_each); optional explicit passwords come from a separate sensitive map, never used as a key. Generated passwords and the connection URI are exported as sensitive outputs.

Usage

module "database" {
  source = "./upcloud-managed-database"

  name       = "app-pg"
  zone       = "de-fra1"
  plan       = "2x2xCPU-4GB-100GB"
  pg_version = "17"

  ip_filter = ["203.0.113.0/24"] # office / bastion CIDR

  users = {
    app      = { allow_replication = false }
    reporter = { allow_replication = false }
  }

  logical_databases = {
    app = { character_set = "UTF8", collation = "en_US.UTF-8" }
  }

  labels = { environment = "prod" }
}

Inputs

NameTypeDefaultDescription
namestringService name / hostname prefix (required)
zonestringUpCloud zone slug, e.g. de-fra1 (required)
planstring1x1xCPU-2GB-25GBManaged-database plan slug (node count, vCPU, RAM, disk)
titlestringnullConsole title (defaults to name)
pg_versionstring17PostgreSQL major version
termination_protectionbooltrueBlock deletion while enabled
maintenance_window_dowstringsundayMaintenance weekday (lowercase)
maintenance_window_timestring03:00:00Maintenance start HH:MM:SS (UTC)
public_accessboolfalseExpose a public endpoint (requires non-empty ip_filter)
ip_filterlist(string)[]Allowed inbound CIDRs; empty = deny all
automatic_utility_network_ip_filterbooltrueAuto-allow same utility-network servers
backup_hournumber2UTC hour (0–23) for the daily backup
backup_minutenumber0Minute (0–59) for the daily backup
private_networkobjectnullSDN attachment {name, uuid, family}
log_min_duration_statementnumber-1Log statements slower than N ms (-1 = off)
idle_in_transaction_session_timeoutnumber0Kill idle-in-transaction after N ms (0 = off)
work_memnumbernullPer-operation work memory in MB
pg_timezonestringnullDefault server timezone (PGTZ)
usersmap(object){}Additional users keyed by username
user_passwordsmap(string){} (sensitive)Optional explicit passwords keyed by username
logical_databasesmap(object){}Logical databases keyed by name (character_set, collation)
labelsmap(string){}Labels applied to the service

Outputs

NameDescription
service_idService UUID
service_hostPrimary connection hostname
service_portPrimary connection port
service_usernameDefault (admin) username
service_passwordDefault (admin) password (sensitive)
service_uriFull connection URI (sensitive)
primary_databasePrimary logical database name
sslmodeRequired TLS mode
stateOperational state
user_namesAdditional usernames created
user_passwordsMap username => password (sensitive)
logical_database_namesAdditional logical database names

Requirements

RequirementVersion
Terraform / OpenTofu>= 1.6
UpCloudLtd/upcloud>= 5.0, < 6.0

License

Commercial — LicenseRef-IaCBazaar-Commercial. See the IaC Bazaar terms.