cloudstack

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2021 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "packer.cloudstack"

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {

	// StateData should store data such as GeneratedData
	// to be shared with post-processors
	StateData map[string]interface{}
	// contains filtered or unexported fields
}

Artifact represents a CloudStack template as the result of a Packer build.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

BuilderId returns the builder ID.

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

Destroy the CloudStack template represented by the artifact.

func (*Artifact) Files

func (a *Artifact) Files() []string

Files returns the files represented by the artifact.

func (*Artifact) Id

func (a *Artifact) Id() string

Id returns CloudStack template ID.

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

State returns specific details from the artifact.

func (*Artifact) String

func (a *Artifact) String() string

String returns the string representation of the artifact.

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder represents the CloudStack builder.

func (*Builder) ConfigSpec added in v1.5.0

func (b *Builder) ConfigSpec() hcldec.ObjectSpec

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error)

func (*Builder) Run

Run implements the packersdk.Builder interface.

type Config

type Config struct {
	common.PackerConfig    `mapstructure:",squash"`
	commonsteps.HTTPConfig `mapstructure:",squash"`
	Comm                   communicator.Config `mapstructure:",squash"`

	// The CloudStack API endpoint we will connect to. It can
	// also be specified via environment variable CLOUDSTACK_API_URL, if set.
	APIURL string `mapstructure:"api_url" required:"true"`
	// The API key used to sign all API requests. It can also
	// be specified via environment variable CLOUDSTACK_API_KEY, if set.
	APIKey string `mapstructure:"api_key" required:"true"`
	// The secret key used to sign all API requests. It
	// can also be specified via environment variable CLOUDSTACK_SECRET_KEY, if
	// set.
	SecretKey string `mapstructure:"secret_key" required:"true"`
	// The time duration to wait for async calls to
	// finish. Defaults to 30m.
	AsyncTimeout time.Duration `mapstructure:"async_timeout" required:"false"`
	// Some cloud providers only allow HTTP GET calls
	// to their CloudStack API. If using such a provider, you need to set this to
	// true in order for the provider to only make GET calls and no POST calls.
	HTTPGetOnly bool `mapstructure:"http_get_only" required:"false"`
	// Set to true to skip SSL verification.
	// Defaults to false.
	SSLNoVerify bool `mapstructure:"ssl_no_verify" required:"false"`
	// List of CIDR's that will have access to the new
	// instance. This is needed in order for any provisioners to be able to
	// connect to the instance. Defaults to [ "0.0.0.0/0" ]. Only required when
	// use_local_ip_address is false.
	CIDRList []string `mapstructure:"cidr_list" required:"false"`
	// If true a temporary security group
	// will be created which allows traffic towards the instance from the
	// cidr_list. This option will be ignored if security_groups is also
	// defined. Requires expunge set to true. Defaults to false.
	CreateSecurityGroup bool `mapstructure:"create_security_group" required:"false"`
	// The name or ID of the disk offering used for the
	// instance. This option is only available (and also required) when using
	// source_iso.
	DiskOffering string `mapstructure:"disk_offering" required:"false"`
	// The size (in GB) of the root disk of the new
	// instance. This option is only available when using source_template.
	DiskSize int64 `mapstructure:"disk_size" required:"false"`
	// If `true` make a call to the CloudStack API, after loading image to
	// cache, requesting to check and detach ISO file (if any) currently
	// attached to a virtual machine. Defaults to `false`. This option is only
	// available when using `source_iso`.
	EjectISO bool `mapstructure:"eject_iso"`
	// Configure the duration time to wait, making sure virtual machine is able
	// to finish installing OS before it ejects safely. Requires `eject_iso`
	// set to `true` and this option is only available when using `source_iso`.
	EjectISODelay time.Duration `mapstructure:"eject_iso_delay"`
	// Set to true to expunge the instance when it is
	// destroyed. Defaults to false.
	Expunge bool `mapstructure:"expunge" required:"false"`
	// The target hypervisor (e.g. XenServer, KVM) for
	// the new template. This option is required when using source_iso.
	Hypervisor string `mapstructure:"hypervisor" required:"false"`
	// The name of the instance. Defaults to
	// "packer-UUID" where UUID is dynamically generated.
	InstanceName string `mapstructure:"instance_name" required:"false"`
	// The display name of the instance. Defaults to "Created by Packer".
	InstanceDisplayName string `mapstructure:"instance_display_name" required:"false"`
	// The name or ID of the network to connect the instance
	// to.
	Network string `mapstructure:"network" required:"true"`
	// The name or ID of the project to deploy the instance
	// to.
	Project string `mapstructure:"project" required:"false"`
	// The public IP address or it's ID used for
	// connecting any provisioners to. If not provided, a temporary public IP
	// address will be associated and released during the Packer run.
	PublicIPAddress string `mapstructure:"public_ip_address" required:"false"`
	// The fixed port you want to configure in the port
	// forwarding rule. Set this attribute if you do not want to use the a random
	// public port.
	PublicPort int `mapstructure:"public_port" required:"false"`
	// A list of security group IDs or
	// names to associate the instance with.
	SecurityGroups []string `mapstructure:"security_groups" required:"false"`
	// The name or ID of the service offering used
	// for the instance.
	ServiceOffering string `mapstructure:"service_offering" required:"true"`
	// Set to true to prevent network
	// ACLs or firewall rules creation. Defaults to false.
	PreventFirewallChanges bool `mapstructure:"prevent_firewall_changes" required:"false"`
	// The name or ID of an ISO that will be mounted
	// before booting the instance. This option is mutually exclusive with
	// source_template. When using source_iso, both disk_offering and
	// hypervisor are required.
	SourceISO string `mapstructure:"source_iso" required:"true"`
	// The name or ID of the template used as base
	// template for the instance. This option is mutually exclusive with
	// source_iso.
	SourceTemplate string `mapstructure:"source_template" required:"true"`
	// The name of the temporary SSH key pair
	// to generate. By default, Packer generates a name that looks like
	// `packer_<UUID>`, where `<UUID>` is a 36 character unique identifier.
	TemporaryKeypairName string `mapstructure:"temporary_keypair_name" required:"false"`
	// Set to true to indicate that the
	// provisioners should connect to the local IP address of the instance.
	UseLocalIPAddress bool `mapstructure:"use_local_ip_address" required:"false"`
	// User data to launch with the instance. This is a
	// template engine; see "User Data" below for
	// more details. Packer will not automatically wait for a user script to
	// finish before shutting down the instance this must be handled in a
	// provisioner.
	UserData string `mapstructure:"user_data" required:"false"`
	// Path to a file that will be used for the user
	// data when launching the instance. This file will be parsed as a template
	// engine see User Data below for more
	// details.
	UserDataFile string `mapstructure:"user_data_file" required:"false"`
	// The name or ID of the zone where the instance will be
	// created.
	Zone string `mapstructure:"zone" required:"true"`
	// The name of the new template. Defaults to
	// `packer-{{timestamp}}` where timestamp will be the current time.
	TemplateName string `mapstructure:"template_name" required:"false"`
	// The display text of the new template.
	// Defaults to the template_name.
	TemplateDisplayText string `mapstructure:"template_display_text" required:"false"`
	// The name or ID of the template OS for the new
	// template that will be created.
	TemplateOS string `mapstructure:"template_os" required:"true"`
	// Set to true to indicate that the template
	// is featured. Defaults to false.
	TemplateFeatured bool `mapstructure:"template_featured" required:"false"`
	// Set to true to indicate that the template
	// is available for all accounts. Defaults to false.
	TemplatePublic bool `mapstructure:"template_public" required:"false"`
	// Set to true to indicate the
	// template should be password enabled. Defaults to false.
	TemplatePasswordEnabled bool `mapstructure:"template_password_enabled" required:"false"`
	// Set to true to indicate the template
	// requires hardware-assisted virtualization. Defaults to false.
	TemplateRequiresHVM bool `mapstructure:"template_requires_hvm" required:"false"`
	// Set to true to indicate that the template
	// contains tools to support dynamic scaling of VM cpu/memory. Defaults to
	// false.
	TemplateScalable bool `mapstructure:"template_scalable" required:"false"`
	//
	TemplateTag string `mapstructure:"template_tag"`

	Tags map[string]string `mapstructure:"tags"`
	// contains filtered or unexported fields
}

Config holds all the details needed to configure the builder.

func (*Config) FlatMapstructure added in v1.4.5

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

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.

func (*Config) Prepare added in v1.5.0

func (c *Config) Prepare(raws ...interface{}) error

NewConfig parses and validates the given config.

type FlatConfig added in v1.4.5

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"`
	HTTPDir                   *string           `mapstructure:"http_directory" cty:"http_directory" hcl:"http_directory"`
	HTTPContent               map[string]string `mapstructure:"http_content" cty:"http_content" hcl:"http_content"`
	HTTPPortMin               *int              `mapstructure:"http_port_min" cty:"http_port_min" hcl:"http_port_min"`
	HTTPPortMax               *int              `mapstructure:"http_port_max" cty:"http_port_max" hcl:"http_port_max"`
	HTTPAddress               *string           `mapstructure:"http_bind_address" cty:"http_bind_address" hcl:"http_bind_address"`
	HTTPInterface             *string           `mapstructure:"http_interface" undocumented:"true" cty:"http_interface" hcl:"http_interface"`
	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"`
	APIURL                    *string           `mapstructure:"api_url" required:"true" cty:"api_url" hcl:"api_url"`
	APIKey                    *string           `mapstructure:"api_key" required:"true" cty:"api_key" hcl:"api_key"`
	SecretKey                 *string           `mapstructure:"secret_key" required:"true" cty:"secret_key" hcl:"secret_key"`
	AsyncTimeout              *string           `mapstructure:"async_timeout" required:"false" cty:"async_timeout" hcl:"async_timeout"`
	HTTPGetOnly               *bool             `mapstructure:"http_get_only" required:"false" cty:"http_get_only" hcl:"http_get_only"`
	SSLNoVerify               *bool             `mapstructure:"ssl_no_verify" required:"false" cty:"ssl_no_verify" hcl:"ssl_no_verify"`
	CIDRList                  []string          `mapstructure:"cidr_list" required:"false" cty:"cidr_list" hcl:"cidr_list"`
	CreateSecurityGroup       *bool             `mapstructure:"create_security_group" required:"false" cty:"create_security_group" hcl:"create_security_group"`
	DiskOffering              *string           `mapstructure:"disk_offering" required:"false" cty:"disk_offering" hcl:"disk_offering"`
	DiskSize                  *int64            `mapstructure:"disk_size" required:"false" cty:"disk_size" hcl:"disk_size"`
	EjectISO                  *bool             `mapstructure:"eject_iso" cty:"eject_iso" hcl:"eject_iso"`
	EjectISODelay             *string           `mapstructure:"eject_iso_delay" cty:"eject_iso_delay" hcl:"eject_iso_delay"`
	Expunge                   *bool             `mapstructure:"expunge" required:"false" cty:"expunge" hcl:"expunge"`
	Hypervisor                *string           `mapstructure:"hypervisor" required:"false" cty:"hypervisor" hcl:"hypervisor"`
	InstanceName              *string           `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"`
	InstanceDisplayName       *string           `mapstructure:"instance_display_name" required:"false" cty:"instance_display_name" hcl:"instance_display_name"`
	Network                   *string           `mapstructure:"network" required:"true" cty:"network" hcl:"network"`
	Project                   *string           `mapstructure:"project" required:"false" cty:"project" hcl:"project"`
	PublicIPAddress           *string           `mapstructure:"public_ip_address" required:"false" cty:"public_ip_address" hcl:"public_ip_address"`
	PublicPort                *int              `mapstructure:"public_port" required:"false" cty:"public_port" hcl:"public_port"`
	SecurityGroups            []string          `mapstructure:"security_groups" required:"false" cty:"security_groups" hcl:"security_groups"`
	ServiceOffering           *string           `mapstructure:"service_offering" required:"true" cty:"service_offering" hcl:"service_offering"`
	PreventFirewallChanges    *bool             `mapstructure:"prevent_firewall_changes" required:"false" cty:"prevent_firewall_changes" hcl:"prevent_firewall_changes"`
	SourceISO                 *string           `mapstructure:"source_iso" required:"true" cty:"source_iso" hcl:"source_iso"`
	SourceTemplate            *string           `mapstructure:"source_template" required:"true" cty:"source_template" hcl:"source_template"`
	TemporaryKeypairName      *string           `mapstructure:"temporary_keypair_name" required:"false" cty:"temporary_keypair_name" hcl:"temporary_keypair_name"`
	UseLocalIPAddress         *bool             `mapstructure:"use_local_ip_address" required:"false" cty:"use_local_ip_address" hcl:"use_local_ip_address"`
	UserData                  *string           `mapstructure:"user_data" required:"false" cty:"user_data" hcl:"user_data"`
	UserDataFile              *string           `mapstructure:"user_data_file" required:"false" cty:"user_data_file" hcl:"user_data_file"`
	Zone                      *string           `mapstructure:"zone" required:"true" cty:"zone" hcl:"zone"`
	TemplateName              *string           `mapstructure:"template_name" required:"false" cty:"template_name" hcl:"template_name"`
	TemplateDisplayText       *string           `mapstructure:"template_display_text" required:"false" cty:"template_display_text" hcl:"template_display_text"`
	TemplateOS                *string           `mapstructure:"template_os" required:"true" cty:"template_os" hcl:"template_os"`
	TemplateFeatured          *bool             `mapstructure:"template_featured" required:"false" cty:"template_featured" hcl:"template_featured"`
	TemplatePublic            *bool             `mapstructure:"template_public" required:"false" cty:"template_public" hcl:"template_public"`
	TemplatePasswordEnabled   *bool             `mapstructure:"template_password_enabled" required:"false" cty:"template_password_enabled" hcl:"template_password_enabled"`
	TemplateRequiresHVM       *bool             `mapstructure:"template_requires_hvm" required:"false" cty:"template_requires_hvm" hcl:"template_requires_hvm"`
	TemplateScalable          *bool             `mapstructure:"template_scalable" required:"false" cty:"template_scalable" hcl:"template_scalable"`
	TemplateTag               *string           `mapstructure:"template_tag" cty:"template_tag" hcl:"template_tag"`
	Tags                      map[string]string `mapstructure:"tags" cty:"tags" hcl:"tags"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec added in v1.4.5

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL