Home // Cloud Infrastructure // Odoo Development // AI & Automation // Odoo + AI Agents Case Studies About Blog Free Assessment
// DATABASE INFRASTRUCTURE · 12 MIN READ

Delphix + Terraform: Automating Oracle VDB Infrastructure

How to combine Delphix virtual databases with Terraform to deliver compliant, masked, thin-provisioned non-production Oracle environments at a fraction of the storage cost — including the provider quirks, the state management patterns, and the masking workflow that keeps auditors happy.

// PUBLISHED 2026-04-23 · LANIAKEA TEAM

The Problem This Pattern Solves

Most mid-to-large enterprises with a non-trivial Oracle footprint have the same operational failure: non-production environments (dev, QA, UAT, perf, training, data science) are either running against stale production snapshots (weeks or months old), running with unmasked PII (PCI / HIPAA / SOC 2 audit finding waiting to happen), or consuming absurd amounts of storage because every environment is a full copy.

The Delphix + Terraform pattern solves all three problems in one architecture. This article walks through what the implementation actually looks like — not the marketing overview, the real engineering.

Architecture Overview

  1. A Delphix Virtualization Engine ingests production Oracle data continuously via a logical replica
  2. A Delphix Masking Engine runs deterministic masking transforms (SSN, credit card, PHI, PAN) against the ingested dataset
  3. Masked datasets become the source for Virtual Database (VDB) provisioning
  4. Non-production environments consume VDBs — thin-provisioned Oracle instances that share underlying blocks with the masked source, occupying only the delta of changes
  5. Terraform manages the lifecycle — create, refresh, rewind, destroy — as infrastructure code

The end state: six non-production environments running on what amounts to a fraction of the storage of a single full copy, each with production-current masked data, each refreshable in 10–15 minutes.

The Delphix Terraform Provider

Delphix maintains a Terraform provider (registry.terraform.io/delphix-integrations/delphix) that exposes the core operations: engine authentication, source ingestion, VDB provisioning, snapshots, refresh, rewind, and destroy.

The provider is functional but not fully idempotent in the way you'd expect from the AWS or Azure providers. Two behaviors worth knowing up front:

Minimal Working Pattern

A simplified resource block for a Dev environment VDB, masked:

resource "delphix_vdb" "dev_orders" {
  source_data_id       = data.delphix_source.masked_orders.id
  name                 = "dev-orders-${var.team_id}"
  target_group_id      = data.delphix_group.nonprod.id
  environment_id       = data.delphix_environment.dev_host.id
  environment_user_id  = data.delphix_env_user.oracle_owner.id

  auto_select_repository = true
  oracle_instance_name   = "DEVORD${var.team_id}"
  mount_point            = "/mnt/delphix/dev-orders-${var.team_id}"

  lifecycle {
    # Prevent accidental destroy on state drift
    prevent_destroy = false
    ignore_changes  = [source_data_id]
  }
}

The VDB is created from the masked source, placed on a designated non-prod Oracle target host, and named with a team ID so conflicts across parallel workspaces don't occur.

Refresh Workflow

Refreshing a VDB to the latest masked snapshot is the daily operation that matters most. The Terraform provider exposes refresh as a resource parameter change, but the cleaner pattern is to trigger refresh via a null_resource with a local-exec that calls the Delphix API directly:

resource "null_resource" "dev_orders_refresh" {
  triggers = {
    # Refresh when a team asks for it
    refresh_token = var.refresh_token
  }
  provisioner "local-exec" {
    command = <<-EOT
      curl -X POST ${var.delphix_url}/resources/json/delphix/database/${delphix_vdb.dev_orders.id}/refresh \
        -H "Authorization: Bearer ${var.delphix_api_token}" \
        -d '{"type":"RefreshParameters","timeflowPointParameters":{"type":"TimeflowPointSemantic","location":"LATEST_SNAPSHOT"}}'
    EOT
  }
}

Teams can request a refresh by incrementing a variable in their workspace config. The null_resource fires the API call. VDB refreshes in 10–15 minutes. No DBA ticket required.

The Masking Workflow

Masking is the step that protects you in every future audit. The Delphix Masking Engine runs separately from the Virtualization Engine and uses rule-based transforms:

Every table that touches PII is in the ruleset. Auditors asking "how do you know non-prod doesn't have production PII?" get the ruleset, the masking job run logs, and the verification queries. That's the audit answer.

The masking trap: do not mask on the VDB after provisioning. Mask the source dataset once. Every VDB provisioned from the masked source inherits the masking. If you mask per-VDB, you're doing the same work six times and creating six opportunities to miss a table. One mask, many reads.

State Management

Terraform state for Delphix VDBs should live in a remote backend (S3 + DynamoDB lock on AWS, or Terraform Cloud). Two guidelines:

Cost Math on a Representative Workload

Production Oracle: 2 TB. Six non-production environments required.

Traditional full-copy approach:

Delphix + Terraform approach:

At typical enterprise storage rates, the annual storage cost savings alone usually justify the Delphix license within 18 months. The engineering productivity improvement — dev teams testing against data that's hours old instead of months old — is harder to quantify but arguably larger.

Operational Gotchas

The Bottom Line

Delphix + Terraform is not a new architecture — it's been used by Fortune-500 financial services firms for over a decade. What's changed is that the Terraform provider is now mature enough to manage VDB lifecycle as infrastructure code, which brings this pattern into reach for mid-market teams that previously couldn't justify a dedicated Delphix admin.

If your Oracle non-production environments are running against stale data, consuming absurd storage, or exposing unmasked PII, the Delphix + Terraform pattern is the modern answer. It's also the pattern most mid-market teams under-invest in because it doesn't ship customer features — even though it silently determines how fast engineering can move and how clean your next audit goes.

Modernize your non-prod database infrastructure?

We architect Delphix + Terraform environments for regulated workloads. 30-minute scoping call, written recommendation in 5–7 business days.