Question

Unable to resolve DNS from with a droplet created via terraform

I’ve created a droplet and firewall config (using terraform) from the docker-18-04 and docker-20-04 images and I am unable to perform any DNS resolution from within these hosts. I’ve opened 53/tcp and 53/udp outgoing in the DO firewall, and tried opening them using UFW on the host as well just in case, with no luck. What else would interfere with DNS resolution from within a newly created droplet?

Just in case it helps, this is what the relevant part of the config looks like in terraform:

resource "digitalocean_droplet" "cafe" {
  image = "docker-20-04"
  name = "cafe"
  region = "sfo2"
  size = "s-2vcpu-4gb"
  private_networking = false
  monitoring = true
  ssh_keys = [
    digitalocean_ssh_key.hal.fingerprint
  ]
}

resource "digitalocean_firewall" "cafe" {
  name = "cafe"
  droplet_ids = [ digitalocean_droplet.cafe.id ]
  inbound_rule {
      protocol = "tcp"
      port_range = "22"
      source_addresses = var.vpn_source_addrs
  }
  inbound_rule {
      protocol = "tcp"
      port_range = "443"
  }
  inbound_rule {
    protocol = "icmp"
  }
  outbound_rule {
    protocol = "tcp"
    port_range = "53"
  }
  outbound_rule {
    protocol = "udp"
    port_range = "53"
  }
  outbound_rule {
    protocol = "icmp"
  }
}


Subscribe
Share

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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

It’s actually a problem with all outgoing traffic, I’ve rewritten the question: https://www.digitalocean.com/community/questions/droplets-created-with-terraform-have-no-outgoing-network-access