COREDNS-IMPORT(7)

πŸ“¦
version 1.15.0 Β· 2 versions
, in nixpkgs unstable, opensuse-leap 16.0

πŸŽ€ NAME πŸŽ€

import is the CoreDNS plugin that includes files or references snippets from a Corefile. Yep, that's the whole vibe: page COREDNS-IMPORT(7) from the CoreDNS Plugins manual, and it's lowkey a lifesaver for keeping your config from turning into copy-paste chaos. πŸ’…

✨ DESCRIPTION ✨

Okay so the import plugin has two main-character jobs, bestie:

  • It can include files into the main configuration.
  • It can reference predefined snippets.

Both? Literally here to save you from duplicating stuff over and over. No cap. 🫢

And here's the unique lil flex: import can appear outside of a server block. In other words? It can sit at the top of a Corefile where an address would normally be. Iconic behavior, honestly. πŸ‘‘

🧚 SYNTAX 🧚

import PATTERN
  • PATTERN β€” the file, glob pattern (*), or snippet you want to include. Its contents will replace this line, as if that file's contents appeared here to begin with. Like a lil magical copy-paste, but make it config. ✨
⚠️ A Corefile may contain at most 10000 import statements. A glob pattern counts as a single import. That limit protects the configuration from recursive imports. So yeah β€” don't go feral with it. 😭

🌸 FILES 🌸

You can use import to include a file or files. This file's location is relative to the Corefile's location.

πŸ’€ It is an error if a specific file cannot be found. But an empty glob pattern is not an error. Important distinction, bestie β€” write it down.

πŸ¦‹ SNIPPETS πŸ¦‹

You can define snippets to be reused later in your Corefile by defining a block with a single-token label surrounded by parentheses:

(mysnippet) {
    ...
}

Then you can invoke the snippet with import:

import mysnippet

Slay. Reusable config snippets are giving organized queen energy. πŸŽ€

πŸ”₯ EXAMPLES πŸ”₯

Import a shared configuration:

. {
   import config/common.conf
}

Where config/common.conf contains:

prometheus
errors
log

This imports files found in the zones directory:

import ../zones/*

πŸ‘‘ SEE ALSO πŸ‘‘

See corefile(5).


Source/version: CoreDNS β€” dated March 2026 β€” page COREDNS-IMPORT(7). That's the whole manual page, bestie; go forth and import responsibly. πŸ’–

πŸ“¦ where this page comes from