run-dns-server

star 140

Guide for running a local containerized DNS server. Use this when asked to run an acceptance test or to run a test with the prefix `TestAcc`.

hashicorp By hashicorp schedule Updated 1/22/2026

name: run-dns-server description: Guide for running a local containerized DNS server. Use this when asked to run an acceptance test or to run a test with the prefix TestAcc.

Before running any acceptance tests for the DNS provider, start a DNS server:

  1. Check whether the DNS server is already alive by querying its locally-mapped port:

    dig @127.0.0.1 -p 15353 +short ns.example.com
    

    Expected command output is "127.0.0.1."

  2. If the DNS server is not already alive, then start the DNS server by running this command in the background:

    docker run --privileged --cgroupns=host -d --tmpfs /tmp --tmpfs /run \
     -v /sys/fs/cgroup:/sys/fs/cgroup:rw \
     -v /etc/localtime:/etc/localtime:ro \
     -v $PWD/internal/provider/testdata/named.conf.kerberos:/etc/named.conf:ro \
     -p 127.0.0.1:15353:53 \
     -p 127.0.0.1:15353:53/udp \
     --rm --name ns --hostname ns.example.com ns
    
  3. After starting the DNS server, verify that the DNS server is alive by querying its locally-mapped port:

    dig @127.0.0.1 -p 15353 +short ns.example.com
    

    Expected command output is "127.0.0.1." Display no output unless there is a problem.

  4. If there is a problem, do not run the acceptance tests.

Add these environment variables to all go test commands for acceptance tests in the DNS provider:

  • DNS_UPDATE_SERVER=127.0.0.1
  • DNS_UPDATE_PORT=15353
Install via CLI
npx skills add https://github.com/hashicorp/terraform-provider-dns --skill run-dns-server
Repository Details
star Stars 140
call_split Forks 83
navigation Branch main
article Path SKILL.md
More from Creator