website/content/partials/packer-plugin-sdk/multistep/commonsteps/CDConfig-not-required.mdx
cd_files ([]string) - A list of files to place onto a CD that is attached when the VM is
booted. This can include either files or directories; any directories
will be copied onto the CD recursively, preserving directory structure
hierarchy. Symlinks will have the link's target copied into the directory
tree on the CD where the symlink was. File globbing is allowed.
Usage example (JSON):
"cd_files": ["./somedirectory/meta-data", "./somedirectory/user-data"],
"cd_label": "cidata",
Usage example (HCL):
cd_files = ["./somedirectory/meta-data", "./somedirectory/user-data"]
cd_label = "cidata"
The above will create a CD with two files, user-data and meta-data in the CD root. This specific example is how you would create a CD that can be used for an Ubuntu 20.04 autoinstall.
Since globbing is also supported,
cd_files = ["./somedirectory/*"]
cd_label = "cidata"
Would also be an acceptable way to define the above cd. The difference between providing the directory with or without the glob is whether the directory itself or its contents will be at the CD root.
Use of this option assumes that you have a command line tool installed that can handle the iso creation. Packer will use one of the following tools:
cd_content (map[string]string) - Key/Values to add to the CD. The keys represent the paths, and the values
contents. It can be used alongside cd_files, which is useful to add large
files without loading them into memory. If any paths are specified by both,
the contents in cd_content will take precedence.
Usage example (HCL):
cd_files = ["vendor-data"]
cd_content = {
"meta-data" = jsonencode(local.instance_data)
"user-data" = templatefile("user-data", { packages = ["nginx"] })
}
cd_label = "cidata"
cd_label (string) - CD Label