IaC Bazaar
DigitalOceanPlan-validated

DigitalOcean App Platform Service

Declarative App Platform deployment with services, workers, domains, and alerts.

terraformAlt & Specialty Clouds#digitalocean

Compare Serverless Containers across clouds →

do-app-platformterraform v1.7

Verification

Plan-validated

Passed: module logic verified on a mocked plan — inputs, validation rules, conditional creation and outputs resolve (no real provider, no cloud).

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

do-app-platform

Declarative DigitalOcean App Platform application: HTTP services, background workers, lifecycle jobs, attached managed databases, custom domains with automatic TLS, alerts, and optional DigitalOcean DNS zones — all from one typed module call. Works with Terraform and OpenTofu (>= 1.6), DigitalOcean provider >= 2.0, < 3.0.

Status: static-validated, live-test pending. Validated with tofu fmt, tofu validate, and tflint against the digitalocean/digitalocean provider. Not yet applied against a live DigitalOcean account (App Platform live tests need a real git/registry source), so it ships under live-test quarantine.

Design & secure defaults

  • Secrets stay secret. SECRET env vars are passed in dedicated *_secrets maps marked sensitive = true, emitted with type = "SECRET" (encrypted at rest by App Platform), and never used as a for_each key — keys come from a parallel non-sensitive map. App Platform encrypts the values; they never appear as plaintext GENERAL vars.
  • Deliberate deploys. deploy_on_push defaults to false on every git and registry source, so a push upstream does not silently redeploy production. Opt in per component.
  • HTTPS everywhere. App Platform provisions and renews TLS for every custom domain automatically — there is no plaintext-only path.
  • Single source per component is enforced by validation: a service, worker, or job must define exactly one of image / github / gitlab / git.
  • Fail-loud alerts on by default (DEPLOYMENT_FAILED, DOMAIN_FAILED); add alert_emails to route them.
  • Plan-time invariants (preconditions): at least one runnable component must exist, and every *_secrets entry must reference a defined component.
  • Autoscaling drops the static instance_count automatically when an autoscaling block is set (App Platform rejects both together).

Usage

module "app" {
  source = "github.com/ITfreak/iacbazaar//artifacts/terraform/do-app-platform"

  name   = "example-app"
  region = "fra"

  services = {
    web = {
      http_port = 8080
      github    = { repo = "acme/web", branch = "main" }
      env       = { NODE_ENV = "production" }
    }
  }

  # SECRET env vars, keyed "<service>:<ENV_NAME>".
  service_secrets = {
    "web:API_TOKEN" = var.api_token
  }

  domains      = [{ name = "app.example.com", type = "PRIMARY", zone = "example.com" }]
  alert_emails = ["[email protected]"]
}

See examples/basic for a complete configuration with a service, a worker, an attached PostgreSQL database, a custom domain, and a managed DNS zone.

Key inputs

VariableDescriptionDefault
nameApp name (unique per account)required
regionApp Platform region slug (nyc, ams, fra, …)null (auto)
project_idDigitalOcean project to place the app innull (default)
vpc_idVPC UUID for the app's componentsnull (region default)
servicesMap of HTTP service components (source, ports, health check, autoscaling, env){}
workersMap of worker components (no inbound routing){}
jobsMap of run-to-completion job components (kind){}
databasesMap of attached managed databases (engine, version, production){}
service_secrets / worker_secrets / job_secretsSECRET env vars keyed "<component>:<ENV>" (sensitive){}
app_env / app_secretsShared non-secret / secret env vars{}
domainsCustom domains (name, type, wildcard, zone)[]
managed_dns_zonesDigitalOcean DNS zones to create[]
alertsApp-level alert rules to enable["DEPLOYMENT_FAILED","DOMAIN_FAILED"]
alert_emailsEmails to notify on alerts[]
egress_typeAUTOASSIGN or DEDICATED_IPAUTOASSIGN
featuresApp-level buildpack feature flags[]

Outputs

app_id, app_urn, default_ingress, live_url, live_domain, active_deployment_id, dedicated_ips, updated_at, dns_zone_ids (map), dns_zone_urns (map).

Requirements

  • Terraform or OpenTofu >= 1.6
  • digitalocean/digitalocean provider >= 2.0, < 3.0

Verification

Static-validated (fmt, validate, tflint). Live apply/destroy testing pending cloud sandbox availability — see catalog status.

License

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