{"modulePath":"github.com/oxidecomputer/packer-plugin-oxide","version":"v0.9.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package instance\n\n## Constants\n\n```go\nconst BuilderID = \"oxide.instance\"\n```\n\n## Types\n\n```go\ntype Artifact struct {\n\t// Unique identifier of the created image.\n\tImageID string\n\t// Name of the created image.\n\tImageName string\n\t// Unique identifier of the source image used to create this artifact.\n\tSourceImageID string\n\t// Additional state data associated with the build.\n\tStateData map[string]any\n}\n```\nArtifact represents the Oxide image created by the builder. This artifact contains the image ID and name that can be used to launch new instances.\n\n```go\nfunc (*Artifact) BuilderId() string\n```\nBuilderId returns the builder ID used to create this artifact.\n\n```go\nfunc (a *Artifact) Destroy() error\n```\nDestroy deletes the artifact when it is determined to no longer be needed.\n\n```go\nfunc (a *Artifact) Files() []string\n```\nFiles returns the files associated with the artifact.\n\n```go\nfunc (a *Artifact) Id() string\n```\nId returns the unique identifier for this artifact.\n\n```go\nfunc (a *Artifact) State(name string) any\n```\nState returns builder state related to the artifact.\n\n```go\nfunc (a *Artifact) String() string\n```\nString returns a description of the artifact.\n\n```go\ntype Builder struct {\n\t// contains filtered or unexported fields\n}\n```\nThe \\`oxide-instance\\` builder creates custom images for use with \\[Oxide]([https://oxide.computer](https://oxide.computer)). 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.\n\nThe builder does not manage images. Once it creates an image, it is up to you to use it or delete it.\n\n```go\nfunc (b *Builder) ConfigSpec() hcldec.ObjectSpec\n```\nConfigSpec returns the HCL configuration specification for the builder.\n\n```go\nfunc (b *Builder) Prepare(args ...any) ([]string, []string, error)\n```\nPrepare configures the builder and validates its configuration.\n\n```go\nfunc (b *Builder) Run(\n\tctx context.Context,\n\tui packer.Ui,\n\thook packer.Hook,\n) (packer.Artifact, error)\n```\nRun executes the builder steps to create an Oxide image.\n\n```go\ntype Config struct {\n\tcommon.PackerConfig `mapstructure:\",squash\"`\n\n\t// Packer communicator configuration to configure how Packer connects to the\n\t// instance for provisioning.\n\tComm communicator.Config `mapstructure:\",squash\"`\n\n\t// Oxide API URL (e.g., `https://oxide.sys.example.com`). If not specified,\n\t// this defaults to the value of the `OXIDE_HOST` environment variable. When\n\t// specified, `token` must be specified. Conflicts with `profile`.\n\tHost string `mapstructure:\"host\" required:\"false\"`\n\n\t// Oxide API token. If not specified, this defaults to the value of the\n\t// `OXIDE_TOKEN` environment variable. When specified, `host` must be specified.\n\t// Conflicts with `profile`.\n\tToken string `mapstructure:\"token\" required:\"false\"`\n\n\t// Oxide credentials profile. If not specified, this defaults to the value of\n\t// the `OXIDE_PROFILE` environment variable. Conflicts with `host` and `token`.\n\tProfile string `mapstructure:\"profile\" required:\"false\"`\n\n\t// Skip TLS certificate verification when connecting to the Oxide API.\n\t// Defaults to `false`.\n\tInsecureSkipVerify bool `mapstructure:\"insecure_skip_verify\" required:\"false\"`\n\n\t// Image ID to use for the instance's boot disk. This can be obtained from the\n\t// `oxide-image` data source.\n\tBootDiskImageID string `mapstructure:\"boot_disk_image_id\" required:\"true\"`\n\n\t// Name or ID of the project where the temporary instance and resulting image\n\t// will be created.\n\tProject string `mapstructure:\"project\" required:\"true\"`\n\n\t// Size of the boot disk in bytes. Defaults to `21474836480`, or 20 GiB.\n\tBootDiskSize uint64 `mapstructure:\"boot_disk_size\"`\n\n\t// IP pool to allocate the instance's external IP from. If not specified, the\n\t// silo's default IP pool will be used.\n\tIPPool string `mapstructure:\"ip_pool\"`\n\n\t// VPC to create the instance within. Defaults to `default`.\n\tVPC string `mapstructure:\"vpc\"`\n\n\t// Subnet to create the instance within. Defaults to `default`.\n\tSubnet string `mapstructure:\"subnet\"`\n\n\t// Name of the temporary instance and its boot disk, primary network interface,\n\t// and snapshot. Defaults to `packer-UUID`, where `UUID` is a unique identifier\n\t// generated for the current build. This must be unique to prevent Oxide\n\t// resource name conflicts.\n\tName string `mapstructure:\"name\"`\n\n\t// Hostname of the temporary instance. Defaults to the value of `name`.\n\tHostname string `mapstructure:\"hostname\"`\n\n\t// Number of vCPUs to provision the instance with. Defaults to `1`.\n\tCPUs uint64 `mapstructure:\"cpus\"`\n\n\t// Amount of memory to provision the instance with, in bytes. Defaults to\n\t// `2147483648`, or 2 GiB.\n\tMemory uint64 `mapstructure:\"memory\"`\n\n\t// An array of names or IDs of SSH public keys to inject into the instance.\n\tSSHPublicKeys []string `mapstructure:\"ssh_public_keys\"`\n\n\t// Name of the resulting image artifact. Required unless `skip_create_image`\n\t// is `true`.\n\tArtifactName string `mapstructure:\"artifact_name\" required:\"true\"`\n\n\t// Description of the resulting image artifact. Defaults to a description that\n\t// identifies the Packer build that created it.\n\tArtifactDescription string `mapstructure:\"artifact_description\"`\n\n\t// Operating system of the resulting image artifact. Defaults to the OS of the\n\t// source image as retrieved from Oxide.\n\tArtifactOS string `mapstructure:\"artifact_os\"`\n\n\t// Version of the resulting image artifact. Defaults to the version of the\n\t// source image as retrieved from Oxide.\n\tArtifactVersion string `mapstructure:\"artifact_version\"`\n\n\t// Skip creating the final image. When set to `true`, the build will boot the\n\t// temporary instance and run all provisioners but will not create a snapshot\n\t// or image. The temporary instance is still cleaned up normally. This is useful\n\t// for testing provisioner logic without incurring the cost of image creation.\n\t// Defaults to `false`.\n\tSkipCreateImage bool `mapstructure:\"skip_create_image\" required:\"false\"`\n\n\t// User data for instance initialization systems such as cloud-init. The\n\t// value is a UTF-8 string and will be Base64-encoded by the plugin before\n\t// transmission. The maximum size is 32 KiB, measured before encoding. Use\n\t// Packer's built-in functions such as `file` to read content from disk.\n\t// Packer does not wait for user data to finish executing before shutting\n\t// down the instance. If your user data must complete before the image is\n\t// created, run `cloud-init status --wait` or an equivalent in a\n\t// provisioner.\n\tUserData string `mapstructure:\"user_data\" required:\"false\"`\n\t// contains filtered or unexported fields\n}\n```\nThe configuration arguments for the builder. Arguments can either be required or optional.\n\n```go\nfunc (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }\n```\nFlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a \\`mapstructure:,squash\\` tag are bubbled up.\n\n```go\nfunc (c *Config) Prepare(args ...any) ([]string, error)\n```\nPrepare decodes the configuration and validates it.\n\n```go\ntype FlatConfig struct {\n\tPackerBuildName           *string           `mapstructure:\"packer_build_name\" cty:\"packer_build_name\" hcl:\"packer_build_name\"`\n\tPackerBuilderType         *string           `mapstructure:\"packer_builder_type\" cty:\"packer_builder_type\" hcl:\"packer_builder_type\"`\n\tPackerCoreVersion         *string           `mapstructure:\"packer_core_version\" cty:\"packer_core_version\" hcl:\"packer_core_version\"`\n\tPackerDebug               *bool             `mapstructure:\"packer_debug\" cty:\"packer_debug\" hcl:\"packer_debug\"`\n\tPackerForce               *bool             `mapstructure:\"packer_force\" cty:\"packer_force\" hcl:\"packer_force\"`\n\tPackerOnError             *string           `mapstructure:\"packer_on_error\" cty:\"packer_on_error\" hcl:\"packer_on_error\"`\n\tPackerUserVars            map[string]string `mapstructure:\"packer_user_variables\" cty:\"packer_user_variables\" hcl:\"packer_user_variables\"`\n\tPackerSensitiveVars       []string          `mapstructure:\"packer_sensitive_variables\" cty:\"packer_sensitive_variables\" hcl:\"packer_sensitive_variables\"`\n\tType                      *string           `mapstructure:\"communicator\" cty:\"communicator\" hcl:\"communicator\"`\n\tPauseBeforeConnect        *string           `mapstructure:\"pause_before_connecting\" cty:\"pause_before_connecting\" hcl:\"pause_before_connecting\"`\n\tSSHHost                   *string           `mapstructure:\"ssh_host\" cty:\"ssh_host\" hcl:\"ssh_host\"`\n\tSSHPort                   *int              `mapstructure:\"ssh_port\" cty:\"ssh_port\" hcl:\"ssh_port\"`\n\tSSHUsername               *string           `mapstructure:\"ssh_username\" cty:\"ssh_username\" hcl:\"ssh_username\"`\n\tSSHPassword               *string           `mapstructure:\"ssh_password\" cty:\"ssh_password\" hcl:\"ssh_password\"`\n\tSSHKeyPairName            *string           `mapstructure:\"ssh_keypair_name\" undocumented:\"true\" cty:\"ssh_keypair_name\" hcl:\"ssh_keypair_name\"`\n\tSSHTemporaryKeyPairName   *string           `mapstructure:\"temporary_key_pair_name\" undocumented:\"true\" cty:\"temporary_key_pair_name\" hcl:\"temporary_key_pair_name\"`\n\tSSHTemporaryKeyPairType   *string           `mapstructure:\"temporary_key_pair_type\" cty:\"temporary_key_pair_type\" hcl:\"temporary_key_pair_type\"`\n\tSSHTemporaryKeyPairBits   *int              `mapstructure:\"temporary_key_pair_bits\" cty:\"temporary_key_pair_bits\" hcl:\"temporary_key_pair_bits\"`\n\tSSHCiphers                []string          `mapstructure:\"ssh_ciphers\" cty:\"ssh_ciphers\" hcl:\"ssh_ciphers\"`\n\tSSHClearAuthorizedKeys    *bool             `mapstructure:\"ssh_clear_authorized_keys\" cty:\"ssh_clear_authorized_keys\" hcl:\"ssh_clear_authorized_keys\"`\n\tSSHKEXAlgos               []string          `mapstructure:\"ssh_key_exchange_algorithms\" cty:\"ssh_key_exchange_algorithms\" hcl:\"ssh_key_exchange_algorithms\"`\n\tSSHPrivateKeyFile         *string           `mapstructure:\"ssh_private_key_file\" undocumented:\"true\" cty:\"ssh_private_key_file\" hcl:\"ssh_private_key_file\"`\n\tSSHCertificateFile        *string           `mapstructure:\"ssh_certificate_file\" cty:\"ssh_certificate_file\" hcl:\"ssh_certificate_file\"`\n\tSSHPty                    *bool             `mapstructure:\"ssh_pty\" cty:\"ssh_pty\" hcl:\"ssh_pty\"`\n\tSSHTimeout                *string           `mapstructure:\"ssh_timeout\" cty:\"ssh_timeout\" hcl:\"ssh_timeout\"`\n\tSSHWaitTimeout            *string           `mapstructure:\"ssh_wait_timeout\" undocumented:\"true\" cty:\"ssh_wait_timeout\" hcl:\"ssh_wait_timeout\"`\n\tSSHAgentAuth              *bool             `mapstructure:\"ssh_agent_auth\" undocumented:\"true\" cty:\"ssh_agent_auth\" hcl:\"ssh_agent_auth\"`\n\tSSHDisableAgentForwarding *bool             `mapstructure:\"ssh_disable_agent_forwarding\" cty:\"ssh_disable_agent_forwarding\" hcl:\"ssh_disable_agent_forwarding\"`\n\tSSHHandshakeAttempts      *int              `mapstructure:\"ssh_handshake_attempts\" cty:\"ssh_handshake_attempts\" hcl:\"ssh_handshake_attempts\"`\n\tSSHBastionHost            *string           `mapstructure:\"ssh_bastion_host\" cty:\"ssh_bastion_host\" hcl:\"ssh_bastion_host\"`\n\tSSHBastionPort            *int              `mapstructure:\"ssh_bastion_port\" cty:\"ssh_bastion_port\" hcl:\"ssh_bastion_port\"`\n\tSSHBastionAgentAuth       *bool             `mapstructure:\"ssh_bastion_agent_auth\" cty:\"ssh_bastion_agent_auth\" hcl:\"ssh_bastion_agent_auth\"`\n\tSSHBastionUsername        *string           `mapstructure:\"ssh_bastion_username\" cty:\"ssh_bastion_username\" hcl:\"ssh_bastion_username\"`\n\tSSHBastionPassword        *string           `mapstructure:\"ssh_bastion_password\" cty:\"ssh_bastion_password\" hcl:\"ssh_bastion_password\"`\n\tSSHBastionInteractive     *bool             `mapstructure:\"ssh_bastion_interactive\" cty:\"ssh_bastion_interactive\" hcl:\"ssh_bastion_interactive\"`\n\tSSHBastionPrivateKeyFile  *string           `mapstructure:\"ssh_bastion_private_key_file\" cty:\"ssh_bastion_private_key_file\" hcl:\"ssh_bastion_private_key_file\"`\n\tSSHBastionCertificateFile *string           `mapstructure:\"ssh_bastion_certificate_file\" cty:\"ssh_bastion_certificate_file\" hcl:\"ssh_bastion_certificate_file\"`\n\tSSHFileTransferMethod     *string           `mapstructure:\"ssh_file_transfer_method\" cty:\"ssh_file_transfer_method\" hcl:\"ssh_file_transfer_method\"`\n\tSSHProxyHost              *string           `mapstructure:\"ssh_proxy_host\" cty:\"ssh_proxy_host\" hcl:\"ssh_proxy_host\"`\n\tSSHProxyPort              *int              `mapstructure:\"ssh_proxy_port\" cty:\"ssh_proxy_port\" hcl:\"ssh_proxy_port\"`\n\tSSHProxyUsername          *string           `mapstructure:\"ssh_proxy_username\" cty:\"ssh_proxy_username\" hcl:\"ssh_proxy_username\"`\n\tSSHProxyPassword          *string           `mapstructure:\"ssh_proxy_password\" cty:\"ssh_proxy_password\" hcl:\"ssh_proxy_password\"`\n\tSSHKeepAliveInterval      *string           `mapstructure:\"ssh_keep_alive_interval\" cty:\"ssh_keep_alive_interval\" hcl:\"ssh_keep_alive_interval\"`\n\tSSHReadWriteTimeout       *string           `mapstructure:\"ssh_read_write_timeout\" cty:\"ssh_read_write_timeout\" hcl:\"ssh_read_write_timeout\"`\n\tSSHRemoteTunnels          []string          `mapstructure:\"ssh_remote_tunnels\" cty:\"ssh_remote_tunnels\" hcl:\"ssh_remote_tunnels\"`\n\tSSHLocalTunnels           []string          `mapstructure:\"ssh_local_tunnels\" cty:\"ssh_local_tunnels\" hcl:\"ssh_local_tunnels\"`\n\tSSHPublicKey              []byte            `mapstructure:\"ssh_public_key\" undocumented:\"true\" cty:\"ssh_public_key\" hcl:\"ssh_public_key\"`\n\tSSHPrivateKey             []byte            `mapstructure:\"ssh_private_key\" undocumented:\"true\" cty:\"ssh_private_key\" hcl:\"ssh_private_key\"`\n\tWinRMUser                 *string           `mapstructure:\"winrm_username\" cty:\"winrm_username\" hcl:\"winrm_username\"`\n\tWinRMPassword             *string           `mapstructure:\"winrm_password\" cty:\"winrm_password\" hcl:\"winrm_password\"`\n\tWinRMHost                 *string           `mapstructure:\"winrm_host\" cty:\"winrm_host\" hcl:\"winrm_host\"`\n\tWinRMNoProxy              *bool             `mapstructure:\"winrm_no_proxy\" cty:\"winrm_no_proxy\" hcl:\"winrm_no_proxy\"`\n\tWinRMPort                 *int              `mapstructure:\"winrm_port\" cty:\"winrm_port\" hcl:\"winrm_port\"`\n\tWinRMTimeout              *string           `mapstructure:\"winrm_timeout\" cty:\"winrm_timeout\" hcl:\"winrm_timeout\"`\n\tWinRMRetryInterval        *string           `mapstructure:\"winrm_retry_interval\" cty:\"winrm_retry_interval\" hcl:\"winrm_retry_interval\"`\n\tWinRMConnectTimeout       *string           `mapstructure:\"winrm_connect_timeout\" cty:\"winrm_connect_timeout\" hcl:\"winrm_connect_timeout\"`\n\tWinRMUseSSL               *bool             `mapstructure:\"winrm_use_ssl\" cty:\"winrm_use_ssl\" hcl:\"winrm_use_ssl\"`\n\tWinRMInsecure             *bool             `mapstructure:\"winrm_insecure\" cty:\"winrm_insecure\" hcl:\"winrm_insecure\"`\n\tWinRMUseNTLM              *bool             `mapstructure:\"winrm_use_ntlm\" cty:\"winrm_use_ntlm\" hcl:\"winrm_use_ntlm\"`\n\tHost                      *string           `mapstructure:\"host\" required:\"false\" cty:\"host\" hcl:\"host\"`\n\tToken                     *string           `mapstructure:\"token\" required:\"false\" cty:\"token\" hcl:\"token\"`\n\tProfile                   *string           `mapstructure:\"profile\" required:\"false\" cty:\"profile\" hcl:\"profile\"`\n\tInsecureSkipVerify        *bool             `mapstructure:\"insecure_skip_verify\" required:\"false\" cty:\"insecure_skip_verify\" hcl:\"insecure_skip_verify\"`\n\tBootDiskImageID           *string           `mapstructure:\"boot_disk_image_id\" required:\"true\" cty:\"boot_disk_image_id\" hcl:\"boot_disk_image_id\"`\n\tProject                   *string           `mapstructure:\"project\" required:\"true\" cty:\"project\" hcl:\"project\"`\n\tBootDiskSize              *uint64           `mapstructure:\"boot_disk_size\" cty:\"boot_disk_size\" hcl:\"boot_disk_size\"`\n\tIPPool                    *string           `mapstructure:\"ip_pool\" cty:\"ip_pool\" hcl:\"ip_pool\"`\n\tVPC                       *string           `mapstructure:\"vpc\" cty:\"vpc\" hcl:\"vpc\"`\n\tSubnet                    *string           `mapstructure:\"subnet\" cty:\"subnet\" hcl:\"subnet\"`\n\tName                      *string           `mapstructure:\"name\" cty:\"name\" hcl:\"name\"`\n\tHostname                  *string           `mapstructure:\"hostname\" cty:\"hostname\" hcl:\"hostname\"`\n\tCPUs                      *uint64           `mapstructure:\"cpus\" cty:\"cpus\" hcl:\"cpus\"`\n\tMemory                    *uint64           `mapstructure:\"memory\" cty:\"memory\" hcl:\"memory\"`\n\tSSHPublicKeys             []string          `mapstructure:\"ssh_public_keys\" cty:\"ssh_public_keys\" hcl:\"ssh_public_keys\"`\n\tArtifactName              *string           `mapstructure:\"artifact_name\" required:\"true\" cty:\"artifact_name\" hcl:\"artifact_name\"`\n\tArtifactDescription       *string           `mapstructure:\"artifact_description\" cty:\"artifact_description\" hcl:\"artifact_description\"`\n\tArtifactOS                *string           `mapstructure:\"artifact_os\" cty:\"artifact_os\" hcl:\"artifact_os\"`\n\tArtifactVersion           *string           `mapstructure:\"artifact_version\" cty:\"artifact_version\" hcl:\"artifact_version\"`\n\tSkipCreateImage           *bool             `mapstructure:\"skip_create_image\" required:\"false\" cty:\"skip_create_image\" hcl:\"skip_create_image\"`\n\tUserData                  *string           `mapstructure:\"user_data\" required:\"false\" cty:\"user_data\" hcl:\"user_data\"`\n}\n```\nFlatConfig is an auto-generated flat version of Config. Where the contents of a field with a \\`mapstructure:,squash\\` tag are bubbled up.\n\n```go\nfunc (*FlatConfig) HCL2Spec() map[string]hcldec.Spec\n```\nHCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.\n\n","path":"github.com/oxidecomputer/packer-plugin-oxide/component/builder/instance","name":"instance","synopsis":"","isRedistributable":true}
