COREDNS-IMPORT(7)
π 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
- nixpkgs unstable: coredns 1.14.7
- opensuse-leap 16.0: coredns-extras 1.15.0-bp160.1.1 Β· Apache-2.0 AND MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms