Packer
Oxide
@oxidecomputer
The Oxide Packer plugin is a multi-component plugin for building Oxide images.
- Community
Updated 3 weeks ago
- GitHub(opens in new tab)
Oxide Instance
Type: oxide-instance
The oxide-instance
builder creates custom images for use with
Oxide. The builder launches a temporary instance
from an existing source image, connects to the instance using its external
IP, provisions the instance, and then creates a new image from the instance's
boot disk. The resulting image can be used to launch new instances on Oxide.
The builder does not manage images. Once it creates an image, it is up to you to use it or delete it.
Configuration
The configuration arguments for this builder component. Arguments can either be required or optional.
Required
host
(string) - Oxide API URL (e.g.,https://oxide.sys.example.com
). If not specified, this defaults to the value of theOXIDE_HOST
environment variable.token
(string) - Oxide API token. If not specified, this defaults to the value of theOXIDE_TOKEN
environment variable.boot_disk_image_id
(string) - Image ID to use for the instance's boot disk. This can be obtained from theoxide-image
data source.project
(string) - Name or ID of the project where the temporary instance and resulting image will be created.
Optional
boot_disk_size
(uint64) - Size of the boot disk in bytes. Defaults to21474836480
, or 20 GiB.ip_pool
(string) - IP pool to allocate the instance's external IP from. If not specified, the silo's default IP pool will be used.vpc
(string) - VPC to create the instance within. Defaults todefault
.subnet
(string) - Subnet to create the instance within. Defaults todefault
.name
(string) - Name of the temporary instance. Defaults topacker-{{timestamp}}
.hostname
(string) - Hostname of the temporary instance. Defaults topacker-{{timestamp}}
.cpus
(uint64) - Number of vCPUs to provision the instance with. Defaults to1
.memory
(uint64) - Amount of memory to provision the instance with, in bytes. Defaults to2147483648
, or 2 GiB.ssh_public_keys
([]string) - An array of names or IDs of SSH public keys to inject into the instance.artifact_name
(string) - Name of the resulting image artifact. Defaults topacker-{{timestamp}}
.
Communicator
In addition to the builder configuration, a
communicator
can be configured for this builder.
SSH
This builder automatically generates a temporary SSH key pair that's used to connect to the temporary instance unless one of the following SSH communicator attributes are set.
The temporary SSH public key is uploaded to Oxide, injected into the emphemeral instance, and deleted during cleanup. The temporary SSH private key is used by Packer to connect to the instance.
The name of the temporary SSH public key uploaded to Oxide can be set using the
temporary_key_pair_name
attribute. Generally there's no reason to set this but it's available should it
be necessary.
Examples
Basic build using environment variables for Oxide credentials and an automatically generated SSH key pair.
source "oxide-instance" "example" {
project = "oxide"
boot_disk_image_id = "feb2c8ee-5a1d-4d66-beeb-289b860561bf"
# SSH communicator attributes.
ssh_username = "ubuntu"
}
build {
sources = [
"source.oxide-instance.example",
]
provisioner "shell" {
inline = [
"echo 'Hello from Packer!'",
]
}
}