Every supported adoption command accepts --declarative-output PATH,
including parent adoption commands for portals, APIs, control planes,
AI Gateway instances, Event Gateway control planes, dashboards,
application auth strategies, DCR providers, organization teams, and
Kong Identity directories and auth servers.
The file contains the selected resources with explicit namespace and
protection metadata where applicable. It doesn’t add file-level defaults,
generated managed_by maps, write-only credentials, siblings, or independently
owned descendants. A parent export contains that parent only. Control-plane
group exports retain their existing member IDs without adopting those members.
The destination must be a new file in an existing directory. Existing files
and symlinks fail validation before remote changes. Stdout keeps the usual
adoption results in your selected -o format; the configuration file is
always YAML. kongctl doesn’t edit your existing configuration files.
With --dry-run --declarative-output, kongctl writes proposed configuration
and marks it with a DRY RUN comment. Choose a different destination when
performing the actual adoption. Keep preview files out of your normal
configuration inputs.
For child exports, --parent-ref controls how the generated configuration
links to the parent.
If you omit --parent-ref, the export contains the selected children and an
external parent declaration that uses the parent’s exact remote ID. Planning
needs only the exported file, as long as other referenced resources already
exist or have declarations.
If you set --parent-ref REF, the export contains root-level children with
!ref REF#id parent links and no parent declaration. Planning needs the
exported file and a declaration with that ref for the same remote parent.
--parent-ref names a local declarative ref. It doesn’t select the remote
parent or read existing input files. The gateway, directory, principal, or
auth server selectors still identify the remote parent. A missing ref fails
normal reference validation when you load the files together.
For AI Gateway children, the parent ref names the gateway. For
Kong Identity, it names the nearest parent: a directory for groups and principals,
a principal for identities and basic-auth usernames, or an auth server for
OAuth clients. Without the flag, exports under an external principal also
include the external directory needed to resolve that principal.
--parent-ref is available only on child adoption commands. Parent exports
use the remote ID as their ref. Child exports also use remote IDs, except
for Identity principals and identities, which retain the supplied --ref.
Include each declaration only once across your inputs.