Terraform backup_restore without trusted sources

Currently we are working on a feature-level preview infrastructure for our application using the digitalocean terrafom provider ( In doing so, we’d like to spin up the testable version of our digitalocean app as well as a new database cluster based on the backup of of one of our existing clusters to be able to test with real data. As per the docs this should not be an issue if we use the backup_restore feature:

However, we are running into the issue, that the database is created successfully from the backup but the new database includes the trusted sources config of the existing database cluster which causes the app deployment to fail as it cannot access the db.

As such we’d need to be able to spin up the db cluster from backup without the trusted sources which would be added separately for our new instance. Has anyone experienced something similar or come up with a solution for this?

the config we’re using is

resource "digitalocean_database_cluster" "db_cluster" {
  name       = <our-db-name>
  engine     = "pg"
  version    = "14"
  size       = "db-s-1vcpu-1gb"
  region     = "fra1"
  node_count = 1
  depends_on = [

resource "digitalocean_app" "our-app" {
  spec {
   ... our working app spec

  depends_on = [ digitalocean_database_cluster.db_cluster ]

resource "digitalocean_database_firewall" "db_firewall" {
  cluster_id =

  rule {
    type  = "app"
    value =

  depends_on = [ digitalocean_app.our-app ]

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.