I tried to add complete key on debian 10 and it turns out it requires gnupg. Here's a relevant cloud-init config and error.
apt: preserve_sources_list: true sources: docker.list: source: "deb [arch=amd64] https://download.docker.com/linux/debian $RELEASE edge" key: | -----BEGIN PGP PUBLIC KEY BLOCK----- ... Cloud-init v. 20.2 running 'modules:config' at Thu, 08 Apr 2021 15:33:51 +0000. Up 16.04 seconds. 2021-04-08 15:33:52,098 - cc_apt_configure.py[ERROR]: failed to add apt GPG Key to apt keyring Traceback (most recent call last): File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 553, in add_apt_key_raw util.subp(['apt-key', 'add', '-'], data=key.encode(), target=target) File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2192, in subp cmd=args) cloudinit.util.ProcessExecutionError: Unexpected error while running command. Command: ['apt-key', 'add', '-'] Exit code: 255 Reason: - Stdout: Stderr: E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation 2021-04-08 15:33:52,133 - util.py[WARNING]: Running module apt-configure (<module 'cloudinit.config.cc_apt_configure' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py'>) failed Jarek