Documentation
¶
Overview ¶
Package oci contains a packersdk.Builder implementation that builds Oracle Bare Metal Cloud Services (OCI) images.
Index ¶
Constants ¶
const BuilderId = "packer.oracle.oci"
BuilderId uniquely identifies the builder
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶
type Artifact struct { Image core.Image Region string // StateData should store data such as GeneratedData // to be shared with post-processors StateData map[string]interface{} // contains filtered or unexported fields }
Artifact is an artifact implementation that contains a built Custom Image.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a builder implementation that creates Oracle OCI custom images.
func (*Builder) ConfigSpec ¶
func (b *Builder) ConfigSpec() hcldec.ObjectSpec
type Config ¶
type Config struct { common.PackerConfig `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"` // Instance Principals (OPTIONAL) // If set to true the following can't have non empty values // - AccessCfgFile // - AccessCfgFileAccount // - UserID // - TenancyID // - Region // - Fingerprint // - KeyFile // - PassPhrase InstancePrincipals bool `mapstructure:"use_instance_principals"` // If true, Packer will not create the image. Useful for setting to `true` // during a build test stage. Default `false`. SkipCreateImage bool `mapstructure:"skip_create_image" required:"false"` AccessCfgFile string `mapstructure:"access_cfg_file"` AccessCfgFileAccount string `mapstructure:"access_cfg_file_account"` // Access config overrides UserID string `mapstructure:"user_ocid"` TenancyID string `mapstructure:"tenancy_ocid"` Region string `mapstructure:"region"` Fingerprint string `mapstructure:"fingerprint"` KeyFile string `mapstructure:"key_file"` PassPhrase string `mapstructure:"pass_phrase"` UsePrivateIP bool `mapstructure:"use_private_ip"` SecurityTokenFilePath string `mapstructure:"security_token_file"` AvailabilityDomain string `mapstructure:"availability_domain"` CompartmentID string `mapstructure:"compartment_ocid"` // Image BaseImageID string `mapstructure:"base_image_ocid"` BaseImageFilter ListImagesRequest `mapstructure:"base_image_filter"` ImageName string `mapstructure:"image_name"` ImageCompartmentID string `mapstructure:"image_compartment_ocid"` LaunchMode string `mapstructure:"image_launch_mode"` NicAttachmentType string `mapstructure:"nic_attachment_type"` // Instance InstanceName *string `mapstructure:"instance_name"` InstanceTags map[string]string `mapstructure:"instance_tags"` // HCL cannot be decoded into an interface so for HCL templates you must use the InstanceDefinedTagsJson option, // To be used with https://www.packer.io/docs/templates/hcl_templates/functions/encoding/jsonencode // ref: https://github.com/hashicorp/hcl/issues/291#issuecomment-496347585 InstanceDefinedTagsJson string `mapstructure:"instance_defined_tags_json" required:"false"` InstanceDefinedTags map[string]map[string]interface{} `mapstructure:"instance_defined_tags" mapstructure-to-hcl2:",skip"` Shape string `mapstructure:"shape"` ShapeConfig FlexShapeConfig `mapstructure:"shape_config"` BootVolumeSizeInGBs int64 `mapstructure:"disk_size"` // Metadata optionally contains custom metadata key/value pairs provided in the // configuration. While this can be used to set metadata["user_data"] the explicit // "user_data" and "user_data_file" values will have precedence. // An instance's metadata can be obtained from at http://169.254.169.254 on the // launched instance. Metadata map[string]string `mapstructure:"metadata"` // UserData and UserDataFile file are both optional and mutually exclusive. UserData string `mapstructure:"user_data"` UserDataFile string `mapstructure:"user_data_file"` // Networking SubnetID string `mapstructure:"subnet_ocid"` CreateVnicDetails CreateVNICDetails `mapstructure:"create_vnic_details"` // Tagging Tags map[string]string `mapstructure:"tags"` // HCL cannot be decoded into an interface so for HCL templates you must use the DefinedTagsJson option, // To be used with https://www.packer.io/docs/templates/hcl_templates/functions/encoding/jsonencode // ref: https://github.com/hashicorp/hcl/issues/291#issuecomment-496347585 DefinedTagsJson string `mapstructure:"defined_tags_json" required:"false"` // For JSON templates we keep the map[string]map[string]interface{} DefinedTags map[string]map[string]interface{} `mapstructure:"defined_tags" required:"false" mapstructure-to-hcl2:",skip"` // contains filtered or unexported fields }
func (*Config) ConfigProvider ¶
func (c *Config) ConfigProvider() ocicommon.ConfigurationProvider
func (*Config) FlatMapstructure ¶
FlatMapstructure 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.
type CreateVNICDetails ¶
type CreateVNICDetails struct { // fields that can be specified under "create_vnic_details" AssignPublicIp *bool `mapstructure:"assign_public_ip" required:"false"` // HCL cannot be decoded into an interface so for HCL templates you must use the DefinedTagsJson option, // To be used with https://www.packer.io/docs/templates/hcl_templates/functions/encoding/jsonencode // ref: https://github.com/hashicorp/hcl/issues/291#issuecomment-496347585 DefinedTagsJson string `mapstructure:"defined_tags_json" required:"false"` // For JSON templates we keep the map[string]map[string]interface{} DefinedTags map[string]map[string]interface{} `mapstructure:"defined_tags" mapstructure-to-hcl2:",skip" required:"false"` DisplayName *string `mapstructure:"display_name" required:"false"` FreeformTags map[string]string `mapstructure:"tags" required:"false"` HostnameLabel *string `mapstructure:"hostname_label" required:"false"` NsgIds []string `mapstructure:"nsg_ids" required:"false"` PrivateIp *string `mapstructure:"private_ip" required:"false"` SkipSourceDestCheck *bool `mapstructure:"skip_source_dest_check" required:"false"` SubnetId *string `mapstructure:"subnet_id" required:"false"` }
func (*CreateVNICDetails) FlatMapstructure ¶
func (*CreateVNICDetails) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatCreateVNICDetails. FlatCreateVNICDetails is an auto-generated flat version of CreateVNICDetails. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type Driver ¶
type Driver interface { CreateInstance(ctx context.Context, publicKey string) (string, error) CreateImage(ctx context.Context, id string) (core.Image, error) DeleteImage(ctx context.Context, id string) error GetInstanceIP(ctx context.Context, id string) (string, error) TerminateInstance(ctx context.Context, id string) error WaitForImageCreation(ctx context.Context, id string) error WaitForInstanceState(ctx context.Context, id string, waitStates []string, terminalState string) error UpdateImageCapabilitySchema(ctx context.Context, imageId string) (core.UpdateComputeImageCapabilitySchemaResponse, error) }
Driver interfaces between the builder steps and the OCI SDK.
func NewDriverOCI ¶
NewDriverOCI Creates a new driverOCI with a connected compute client and a connected vcn client.
type FlatConfig ¶
type FlatConfig struct { PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"` PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"` PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"` PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"` PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` Type *string `mapstructure:"communicator" cty:"communicator" hcl:"communicator"` PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting" hcl:"pause_before_connecting"` SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host" hcl:"ssh_host"` SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port" hcl:"ssh_port"` SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username" hcl:"ssh_username"` SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password" hcl:"ssh_password"` SSHKeyPairName *string `mapstructure:"ssh_keypair_name" undocumented:"true" cty:"ssh_keypair_name" hcl:"ssh_keypair_name"` SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" undocumented:"true" cty:"temporary_key_pair_name" hcl:"temporary_key_pair_name"` SSHTemporaryKeyPairType *string `mapstructure:"temporary_key_pair_type" cty:"temporary_key_pair_type" hcl:"temporary_key_pair_type"` SSHTemporaryKeyPairBits *int `mapstructure:"temporary_key_pair_bits" cty:"temporary_key_pair_bits" hcl:"temporary_key_pair_bits"` SSHCiphers []string `mapstructure:"ssh_ciphers" cty:"ssh_ciphers" hcl:"ssh_ciphers"` SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys" hcl:"ssh_clear_authorized_keys"` SSHKEXAlgos []string `mapstructure:"ssh_key_exchange_algorithms" cty:"ssh_key_exchange_algorithms" hcl:"ssh_key_exchange_algorithms"` SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" undocumented:"true" cty:"ssh_private_key_file" hcl:"ssh_private_key_file"` SSHCertificateFile *string `mapstructure:"ssh_certificate_file" cty:"ssh_certificate_file" hcl:"ssh_certificate_file"` SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty" hcl:"ssh_pty"` SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout" hcl:"ssh_timeout"` SSHWaitTimeout *string `mapstructure:"ssh_wait_timeout" undocumented:"true" cty:"ssh_wait_timeout" hcl:"ssh_wait_timeout"` SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" undocumented:"true" cty:"ssh_agent_auth" hcl:"ssh_agent_auth"` SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding" hcl:"ssh_disable_agent_forwarding"` SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts" hcl:"ssh_handshake_attempts"` SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host" hcl:"ssh_bastion_host"` SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port" hcl:"ssh_bastion_port"` SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth" hcl:"ssh_bastion_agent_auth"` SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username" hcl:"ssh_bastion_username"` SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password" hcl:"ssh_bastion_password"` SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive" hcl:"ssh_bastion_interactive"` SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file" hcl:"ssh_bastion_private_key_file"` SSHBastionCertificateFile *string `mapstructure:"ssh_bastion_certificate_file" cty:"ssh_bastion_certificate_file" hcl:"ssh_bastion_certificate_file"` SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method" hcl:"ssh_file_transfer_method"` SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host" hcl:"ssh_proxy_host"` SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port" hcl:"ssh_proxy_port"` SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username" hcl:"ssh_proxy_username"` SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password" hcl:"ssh_proxy_password"` SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval" hcl:"ssh_keep_alive_interval"` SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout" hcl:"ssh_read_write_timeout"` SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels" hcl:"ssh_remote_tunnels"` SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels" hcl:"ssh_local_tunnels"` SSHPublicKey []byte `mapstructure:"ssh_public_key" undocumented:"true" cty:"ssh_public_key" hcl:"ssh_public_key"` SSHPrivateKey []byte `mapstructure:"ssh_private_key" undocumented:"true" cty:"ssh_private_key" hcl:"ssh_private_key"` WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username" hcl:"winrm_username"` WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password" hcl:"winrm_password"` WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host" hcl:"winrm_host"` WinRMNoProxy *bool `mapstructure:"winrm_no_proxy" cty:"winrm_no_proxy" hcl:"winrm_no_proxy"` WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port" hcl:"winrm_port"` WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout" hcl:"winrm_timeout"` WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl" hcl:"winrm_use_ssl"` WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure" hcl:"winrm_insecure"` WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm" hcl:"winrm_use_ntlm"` InstancePrincipals *bool `mapstructure:"use_instance_principals" cty:"use_instance_principals" hcl:"use_instance_principals"` SkipCreateImage *bool `mapstructure:"skip_create_image" required:"false" cty:"skip_create_image" hcl:"skip_create_image"` AccessCfgFile *string `mapstructure:"access_cfg_file" cty:"access_cfg_file" hcl:"access_cfg_file"` AccessCfgFileAccount *string `mapstructure:"access_cfg_file_account" cty:"access_cfg_file_account" hcl:"access_cfg_file_account"` UserID *string `mapstructure:"user_ocid" cty:"user_ocid" hcl:"user_ocid"` TenancyID *string `mapstructure:"tenancy_ocid" cty:"tenancy_ocid" hcl:"tenancy_ocid"` Region *string `mapstructure:"region" cty:"region" hcl:"region"` Fingerprint *string `mapstructure:"fingerprint" cty:"fingerprint" hcl:"fingerprint"` KeyFile *string `mapstructure:"key_file" cty:"key_file" hcl:"key_file"` PassPhrase *string `mapstructure:"pass_phrase" cty:"pass_phrase" hcl:"pass_phrase"` UsePrivateIP *bool `mapstructure:"use_private_ip" cty:"use_private_ip" hcl:"use_private_ip"` SecurityTokenFilePath *string `mapstructure:"security_token_file" cty:"security_token_file" hcl:"security_token_file"` AvailabilityDomain *string `mapstructure:"availability_domain" cty:"availability_domain" hcl:"availability_domain"` CompartmentID *string `mapstructure:"compartment_ocid" cty:"compartment_ocid" hcl:"compartment_ocid"` BaseImageID *string `mapstructure:"base_image_ocid" cty:"base_image_ocid" hcl:"base_image_ocid"` BaseImageFilter *FlatListImagesRequest `mapstructure:"base_image_filter" cty:"base_image_filter" hcl:"base_image_filter"` ImageName *string `mapstructure:"image_name" cty:"image_name" hcl:"image_name"` ImageCompartmentID *string `mapstructure:"image_compartment_ocid" cty:"image_compartment_ocid" hcl:"image_compartment_ocid"` LaunchMode *string `mapstructure:"image_launch_mode" cty:"image_launch_mode" hcl:"image_launch_mode"` NicAttachmentType *string `mapstructure:"nic_attachment_type" cty:"nic_attachment_type" hcl:"nic_attachment_type"` InstanceName *string `mapstructure:"instance_name" cty:"instance_name" hcl:"instance_name"` InstanceTags map[string]string `mapstructure:"instance_tags" cty:"instance_tags" hcl:"instance_tags"` InstanceDefinedTagsJson *string `mapstructure:"instance_defined_tags_json" required:"false" cty:"instance_defined_tags_json" hcl:"instance_defined_tags_json"` Shape *string `mapstructure:"shape" cty:"shape" hcl:"shape"` ShapeConfig *FlatFlexShapeConfig `mapstructure:"shape_config" cty:"shape_config" hcl:"shape_config"` BootVolumeSizeInGBs *int64 `mapstructure:"disk_size" cty:"disk_size" hcl:"disk_size"` Metadata map[string]string `mapstructure:"metadata" cty:"metadata" hcl:"metadata"` UserData *string `mapstructure:"user_data" cty:"user_data" hcl:"user_data"` UserDataFile *string `mapstructure:"user_data_file" cty:"user_data_file" hcl:"user_data_file"` SubnetID *string `mapstructure:"subnet_ocid" cty:"subnet_ocid" hcl:"subnet_ocid"` CreateVnicDetails *FlatCreateVNICDetails `mapstructure:"create_vnic_details" cty:"create_vnic_details" hcl:"create_vnic_details"` Tags map[string]string `mapstructure:"tags" cty:"tags" hcl:"tags"` DefinedTagsJson *string `mapstructure:"defined_tags_json" required:"false" cty:"defined_tags_json" hcl:"defined_tags_json"` }
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatCreateVNICDetails ¶
type FlatCreateVNICDetails struct { AssignPublicIp *bool `mapstructure:"assign_public_ip" required:"false" cty:"assign_public_ip" hcl:"assign_public_ip"` DefinedTagsJson *string `mapstructure:"defined_tags_json" required:"false" cty:"defined_tags_json" hcl:"defined_tags_json"` DisplayName *string `mapstructure:"display_name" required:"false" cty:"display_name" hcl:"display_name"` FreeformTags map[string]string `mapstructure:"tags" required:"false" cty:"tags" hcl:"tags"` HostnameLabel *string `mapstructure:"hostname_label" required:"false" cty:"hostname_label" hcl:"hostname_label"` NsgIds []string `mapstructure:"nsg_ids" required:"false" cty:"nsg_ids" hcl:"nsg_ids"` PrivateIp *string `mapstructure:"private_ip" required:"false" cty:"private_ip" hcl:"private_ip"` SkipSourceDestCheck *bool `mapstructure:"skip_source_dest_check" required:"false" cty:"skip_source_dest_check" hcl:"skip_source_dest_check"` SubnetId *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id" hcl:"subnet_id"` }
FlatCreateVNICDetails is an auto-generated flat version of CreateVNICDetails. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatCreateVNICDetails) HCL2Spec ¶
func (*FlatCreateVNICDetails) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a CreateVNICDetails. This spec is used by HCL to read the fields of CreateVNICDetails. The decoded values from this spec will then be applied to a FlatCreateVNICDetails.
type FlatFlexShapeConfig ¶
type FlatFlexShapeConfig struct { Ocpus *float32 `mapstructure:"ocpus" required:"false" cty:"ocpus" hcl:"ocpus"` MemoryInGBs *float32 `mapstructure:"memory_in_gbs" required:"false" cty:"memory_in_gbs" hcl:"memory_in_gbs"` BaselineOcpuUtilization *string `mapstructure:"baseline_ocpu_utilization" required:"false" cty:"baseline_ocpu_utilization" hcl:"baseline_ocpu_utilization"` }
FlatFlexShapeConfig is an auto-generated flat version of FlexShapeConfig. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatListImagesRequest ¶
type FlatListImagesRequest struct { CompartmentId *string `mapstructure:"compartment_id" cty:"compartment_id" hcl:"compartment_id"` DisplayName *string `mapstructure:"display_name" cty:"display_name" hcl:"display_name"` DisplayNameSearch *string `mapstructure:"display_name_search" cty:"display_name_search" hcl:"display_name_search"` OperatingSystem *string `mapstructure:"operating_system" cty:"operating_system" hcl:"operating_system"` OperatingSystemVersion *string `mapstructure:"operating_system_version" cty:"operating_system_version" hcl:"operating_system_version"` Shape *string `mapstructure:"shape" cty:"shape" hcl:"shape"` }
FlatListImagesRequest is an auto-generated flat version of ListImagesRequest. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatListImagesRequest) HCL2Spec ¶
func (*FlatListImagesRequest) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a ListImagesRequest. This spec is used by HCL to read the fields of ListImagesRequest. The decoded values from this spec will then be applied to a FlatListImagesRequest.
type FlexShapeConfig ¶
type FlexShapeConfig struct { Ocpus *float32 `mapstructure:"ocpus" required:"false"` MemoryInGBs *float32 `mapstructure:"memory_in_gbs" required:"false"` BaselineOcpuUtilization *string `mapstructure:"baseline_ocpu_utilization" required:"false"` }
func (*FlexShapeConfig) FlatMapstructure ¶
func (*FlexShapeConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatFlexShapeConfig. FlatFlexShapeConfig is an auto-generated flat version of FlexShapeConfig. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type ListImagesRequest ¶
type ListImagesRequest struct { // fields that can be specified under "base_image_filter" CompartmentId *string `mapstructure:"compartment_id"` DisplayName *string `mapstructure:"display_name"` DisplayNameSearch *string `mapstructure:"display_name_search"` OperatingSystem *string `mapstructure:"operating_system"` OperatingSystemVersion *string `mapstructure:"operating_system_version"` Shape *string `mapstructure:"shape"` }
func (*ListImagesRequest) FlatMapstructure ¶
func (*ListImagesRequest) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatListImagesRequest. FlatListImagesRequest is an auto-generated flat version of ListImagesRequest. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.