openstack

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: 49 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "mitchellh.openstack"

The unique ID for this builder

Variables

This section is empty.

Functions

func CheckFloatingIP added in v1.3.0

func CheckFloatingIP(client *gophercloud.ServiceClient, id string) (*floatingips.FloatingIP, error)

CheckFloatingIP gets a floating IP by its ID and checks if it is already associated with any internal interface. It returns floating IP if it can be used.

func CheckFloatingIPNetwork added in v1.3.0

func CheckFloatingIPNetwork(client *gophercloud.ServiceClient, networkRef string) (string, error)

CheckFloatingIPNetwork checks provided network reference and returns a valid Networking service ID.

func CommHost added in v0.8.0

func CommHost(
	host string,
	client *gophercloud.ServiceClient,
	sshinterface string,
	sshipversion string) func(multistep.StateBag) (string, error)

CommHost looks up the host for the communicator.

func DiscoverProvisioningNetwork added in v1.4.5

func DiscoverProvisioningNetwork(client *gophercloud.ServiceClient, cidrs []string) (string, error)

DiscoverProvisioningNetwork finds the first network whose subnet matches the given network ranges.

func FindFreeFloatingIP added in v1.3.0

func FindFreeFloatingIP(client *gophercloud.ServiceClient) (*floatingips.FloatingIP, error)

FindFreeFloatingIP returns free unassociated floating IP. It will return first floating IP if there are many.

func GetFloatingIPNetworkIDByName added in v1.3.0

func GetFloatingIPNetworkIDByName(client *gophercloud.ServiceClient, networkName string) (string, error)

GetFloatingIPNetworkIDByName searches for the external network ID by the provided name.

func GetInstancePortID added in v1.3.0

func GetInstancePortID(client *gophercloud.ServiceClient, id string, instance_float_net string) (string, error)

GetInstancePortID returns internal port of the instance that can be used for the association of a floating IP. It will return an ID of a first port if there are many.

func GetVolumeSize added in v1.3.0

func GetVolumeSize(imageClient *gophercloud.ServiceClient, imageID string) (int, error)

GetVolumeSize returns volume size in gigabytes based on the image min disk value if it's not empty. Or it calculates needed gigabytes size from the image bytes size.

func GetVolumeStatus added in v1.3.2

func GetVolumeStatus(blockStorageClient *gophercloud.ServiceClient, volumeID string) (string, error)

func PropertiesSatisfied added in v1.4.2

func PropertiesSatisfied(image *images.Image, props *map[string]string) bool

func WaitForImage

func WaitForImage(ctx context.Context, client *gophercloud.ServiceClient, imageId string) error

WaitForImage waits for the given Image ID to become ready.

func WaitForState

func WaitForState(conf *StateChangeConf) (i interface{}, err error)

WaitForState watches an object and waits for it to achieve a certain state.

func WaitForVolume added in v1.3.0

func WaitForVolume(blockStorageClient *gophercloud.ServiceClient, volumeID string) error

WaitForVolume waits for the given volume to become available.

Types

type AccessConfig

type AccessConfig struct {
	// The username or id used to connect to the OpenStack service. If not
	// specified, Packer will use the environment variable OS_USERNAME or
	// OS_USERID, if set. This is not required if using access token or
	// application credential instead of password, or if using cloud.yaml.
	Username string `mapstructure:"username" required:"true"`
	// Sets username
	UserID string `mapstructure:"user_id"`
	// The password used to connect to the OpenStack service. If not specified,
	// Packer will use the environment variables OS_PASSWORD, if set. This is
	// not required if using access token or application credential instead of
	// password, or if using cloud.yaml.
	Password string `mapstructure:"password" required:"true"`
	// The URL to the OpenStack Identity service. If not specified, Packer will
	// use the environment variables OS_AUTH_URL, if set. This is not required
	// if using cloud.yaml.
	IdentityEndpoint string `mapstructure:"identity_endpoint" required:"true"`
	// The tenant ID or name to boot the instance into. Some OpenStack
	// installations require this. If not specified, Packer will use the
	// environment variable OS_TENANT_NAME or OS_TENANT_ID, if set. Tenant is
	// also called Project in later versions of OpenStack.
	TenantID   string `mapstructure:"tenant_id" required:"false"`
	TenantName string `mapstructure:"tenant_name"`
	DomainID   string `mapstructure:"domain_id"`
	// The Domain name or ID you are authenticating with. OpenStack
	// installations require this if identity v3 is used. Packer will use the
	// environment variable OS_DOMAIN_NAME or OS_DOMAIN_ID, if set.
	DomainName string `mapstructure:"domain_name" required:"false"`
	// Whether or not the connection to OpenStack can be done over an insecure
	// connection. By default this is false.
	Insecure bool `mapstructure:"insecure" required:"false"`
	// The name of the region, such as "DFW", in which to launch the server to
	// create the image. If not specified, Packer will use the environment
	// variable OS_REGION_NAME, if set.
	Region string `mapstructure:"region" required:"false"`
	// The endpoint type to use. Can be any of "internal", "internalURL",
	// "admin", "adminURL", "public", and "publicURL". By default this is
	// "public".
	EndpointType string `mapstructure:"endpoint_type" required:"false"`
	// Custom CA certificate file path. If omitted the OS_CACERT environment
	// variable can be used.
	CACertFile string `mapstructure:"cacert" required:"false"`
	// Client certificate file path for SSL client authentication. If omitted
	// the OS_CERT environment variable can be used.
	ClientCertFile string `mapstructure:"cert" required:"false"`
	// Client private key file path for SSL client authentication. If omitted
	// the OS_KEY environment variable can be used.
	ClientKeyFile string `mapstructure:"key" required:"false"`
	// the token (id) to use with token based authorization. Packer will use
	// the environment variable OS_TOKEN, if set.
	Token string `mapstructure:"token" required:"false"`
	// The application credential name to use with application credential based
	// authorization. Packer will use the environment variable
	// OS_APPLICATION_CREDENTIAL_NAME, if set.
	ApplicationCredentialName string `mapstructure:"application_credential_name" required:"false"`
	// The application credential id to use with application credential based
	// authorization. Packer will use the environment variable
	// OS_APPLICATION_CREDENTIAL_ID, if set.
	ApplicationCredentialID string `mapstructure:"application_credential_id" required:"false"`
	// The application credential secret to use with application credential
	// based authorization. Packer will use the environment variable
	// OS_APPLICATION_CREDENTIAL_SECRET, if set.
	ApplicationCredentialSecret string `mapstructure:"application_credential_secret" required:"false"`
	// An entry in a `clouds.yaml` file. See the OpenStack os-client-config
	// [documentation](https://docs.openstack.org/os-client-config/latest/user/configuration.html)
	// for more information about `clouds.yaml` files. If omitted, the
	// `OS_CLOUD` environment variable is used.
	Cloud string `mapstructure:"cloud" required:"false"`
	// contains filtered or unexported fields
}

AccessConfig is for common configuration related to openstack access

func (*AccessConfig) Prepare

func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error

type Artifact

type Artifact struct {
	// ImageId of built image
	ImageId string

	// BuilderId is the unique ID for the builder that created this image
	BuilderIdValue string

	// OpenStack connection for performing API stuff.
	Client *gophercloud.ServiceClient

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

Artifact is an artifact implementation that contains built images.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State added in v0.7.2

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

func (*Artifact) String

func (a *Artifact) String() string

type Builder

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

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

type Config added in v0.8.0

type Config struct {
	common.PackerConfig `mapstructure:",squash"`

	AccessConfig `mapstructure:",squash"`
	ImageConfig  `mapstructure:",squash"`
	RunConfig    `mapstructure:",squash"`
	// contains filtered or unexported fields
}

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.

type DebugRoundTripper added in v1.6.3

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

func (*DebugRoundTripper) DebugMessage added in v1.6.3

func (drt *DebugRoundTripper) DebugMessage(message string)

func (*DebugRoundTripper) RoundTrip added in v1.6.3

func (drt *DebugRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip performs a round-trip HTTP request and logs relevant information about it.

type ExternalNetwork added in v1.3.0

type ExternalNetwork struct {
	networks.Network
	external.NetworkExternalExt
}

ExternalNetwork is a network with external router.

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"`
	Username                      *string                 `mapstructure:"username" required:"true" cty:"username" hcl:"username"`
	UserID                        *string                 `mapstructure:"user_id" cty:"user_id" hcl:"user_id"`
	Password                      *string                 `mapstructure:"password" required:"true" cty:"password" hcl:"password"`
	IdentityEndpoint              *string                 `mapstructure:"identity_endpoint" required:"true" cty:"identity_endpoint" hcl:"identity_endpoint"`
	TenantID                      *string                 `mapstructure:"tenant_id" required:"false" cty:"tenant_id" hcl:"tenant_id"`
	TenantName                    *string                 `mapstructure:"tenant_name" cty:"tenant_name" hcl:"tenant_name"`
	DomainID                      *string                 `mapstructure:"domain_id" cty:"domain_id" hcl:"domain_id"`
	DomainName                    *string                 `mapstructure:"domain_name" required:"false" cty:"domain_name" hcl:"domain_name"`
	Insecure                      *bool                   `mapstructure:"insecure" required:"false" cty:"insecure" hcl:"insecure"`
	Region                        *string                 `mapstructure:"region" required:"false" cty:"region" hcl:"region"`
	EndpointType                  *string                 `mapstructure:"endpoint_type" required:"false" cty:"endpoint_type" hcl:"endpoint_type"`
	CACertFile                    *string                 `mapstructure:"cacert" required:"false" cty:"cacert" hcl:"cacert"`
	ClientCertFile                *string                 `mapstructure:"cert" required:"false" cty:"cert" hcl:"cert"`
	ClientKeyFile                 *string                 `mapstructure:"key" required:"false" cty:"key" hcl:"key"`
	Token                         *string                 `mapstructure:"token" required:"false" cty:"token" hcl:"token"`
	ApplicationCredentialName     *string                 `` /* 127-byte string literal not displayed */
	ApplicationCredentialID       *string                 `mapstructure:"application_credential_id" required:"false" cty:"application_credential_id" hcl:"application_credential_id"`
	ApplicationCredentialSecret   *string                 `` /* 133-byte string literal not displayed */
	Cloud                         *string                 `mapstructure:"cloud" required:"false" cty:"cloud" hcl:"cloud"`
	ImageName                     *string                 `mapstructure:"image_name" required:"true" cty:"image_name" hcl:"image_name"`
	ImageMetadata                 map[string]string       `mapstructure:"metadata" required:"false" cty:"metadata" hcl:"metadata"`
	ImageVisibility               *images.ImageVisibility `mapstructure:"image_visibility" required:"false" cty:"image_visibility" hcl:"image_visibility"`
	ImageMembers                  []string                `mapstructure:"image_members" required:"false" cty:"image_members" hcl:"image_members"`
	ImageAutoAcceptMembers        *bool                   `mapstructure:"image_auto_accept_members" required:"false" cty:"image_auto_accept_members" hcl:"image_auto_accept_members"`
	ImageDiskFormat               *string                 `mapstructure:"image_disk_format" required:"false" cty:"image_disk_format" hcl:"image_disk_format"`
	ImageTags                     []string                `mapstructure:"image_tags" required:"false" cty:"image_tags" hcl:"image_tags"`
	ImageMinDisk                  *int                    `mapstructure:"image_min_disk" required:"false" cty:"image_min_disk" hcl:"image_min_disk"`
	SkipCreateImage               *bool                   `mapstructure:"skip_create_image" required:"false" cty:"skip_create_image" hcl:"skip_create_image"`
	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"`
	SSHInterface                  *string                 `mapstructure:"ssh_interface" required:"false" cty:"ssh_interface" hcl:"ssh_interface"`
	SSHIPVersion                  *string                 `mapstructure:"ssh_ip_version" required:"false" cty:"ssh_ip_version" hcl:"ssh_ip_version"`
	SourceImage                   *string                 `mapstructure:"source_image" required:"true" cty:"source_image" hcl:"source_image"`
	SourceImageName               *string                 `mapstructure:"source_image_name" required:"true" cty:"source_image_name" hcl:"source_image_name"`
	ExternalSourceImageURL        *string                 `mapstructure:"external_source_image_url" required:"true" cty:"external_source_image_url" hcl:"external_source_image_url"`
	ExternalSourceImageFormat     *string                 `` /* 130-byte string literal not displayed */
	ExternalSourceImageProperties map[string]string       `` /* 142-byte string literal not displayed */
	SourceImageFilters            *FlatImageFilter        `mapstructure:"source_image_filter" required:"true" cty:"source_image_filter" hcl:"source_image_filter"`
	Flavor                        *string                 `mapstructure:"flavor" required:"true" cty:"flavor" hcl:"flavor"`
	AvailabilityZone              *string                 `mapstructure:"availability_zone" required:"false" cty:"availability_zone" hcl:"availability_zone"`
	RackconnectWait               *bool                   `mapstructure:"rackconnect_wait" required:"false" cty:"rackconnect_wait" hcl:"rackconnect_wait"`
	FloatingIPNetwork             *string                 `mapstructure:"floating_ip_network" required:"false" cty:"floating_ip_network" hcl:"floating_ip_network"`
	InstanceFloatingIPNet         *string                 `mapstructure:"instance_floating_ip_net" required:"false" cty:"instance_floating_ip_net" hcl:"instance_floating_ip_net"`
	FloatingIP                    *string                 `mapstructure:"floating_ip" required:"false" cty:"floating_ip" hcl:"floating_ip"`
	ReuseIPs                      *bool                   `mapstructure:"reuse_ips" required:"false" cty:"reuse_ips" hcl:"reuse_ips"`
	SecurityGroups                []string                `mapstructure:"security_groups" required:"false" cty:"security_groups" hcl:"security_groups"`
	Networks                      []string                `mapstructure:"networks" required:"false" cty:"networks" hcl:"networks"`
	Ports                         []string                `mapstructure:"ports" required:"false" cty:"ports" hcl:"ports"`
	NetworkDiscoveryCIDRs         []string                `mapstructure:"network_discovery_cidrs" required:"false" cty:"network_discovery_cidrs" hcl:"network_discovery_cidrs"`
	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"`
	InstanceName                  *string                 `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"`
	InstanceMetadata              map[string]string       `mapstructure:"instance_metadata" required:"false" cty:"instance_metadata" hcl:"instance_metadata"`
	ForceDelete                   *bool                   `mapstructure:"force_delete" required:"false" cty:"force_delete" hcl:"force_delete"`
	ConfigDrive                   *bool                   `mapstructure:"config_drive" required:"false" cty:"config_drive" hcl:"config_drive"`
	FloatingIPPool                *string                 `mapstructure:"floating_ip_pool" required:"false" cty:"floating_ip_pool" hcl:"floating_ip_pool"`
	UseBlockStorageVolume         *bool                   `mapstructure:"use_blockstorage_volume" required:"false" cty:"use_blockstorage_volume" hcl:"use_blockstorage_volume"`
	VolumeName                    *string                 `mapstructure:"volume_name" required:"false" cty:"volume_name" hcl:"volume_name"`
	VolumeType                    *string                 `mapstructure:"volume_type" required:"false" cty:"volume_type" hcl:"volume_type"`
	VolumeSize                    *int                    `mapstructure:"volume_size" required:"false" cty:"volume_size" hcl:"volume_size"`
	VolumeAvailabilityZone        *string                 `mapstructure:"volume_availability_zone" required:"false" cty:"volume_availability_zone" hcl:"volume_availability_zone"`
	OpenstackProvider             *string                 `mapstructure:"openstack_provider" cty:"openstack_provider" hcl:"openstack_provider"`
	UseFloatingIp                 *bool                   `mapstructure:"use_floating_ip" required:"false" cty:"use_floating_ip" hcl:"use_floating_ip"`
}

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.

type FlatImageFilter added in v1.4.5

type FlatImageFilter struct {
	Filters    *FlatImageFilterOptions `mapstructure:"filters" required:"false" cty:"filters" hcl:"filters"`
	MostRecent *bool                   `mapstructure:"most_recent" required:"false" cty:"most_recent" hcl:"most_recent"`
}

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

func (*FlatImageFilter) HCL2Spec added in v1.4.5

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

HCL2Spec returns the hcl spec of a ImageFilter. This spec is used by HCL to read the fields of ImageFilter. The decoded values from this spec will then be applied to a FlatImageFilter.

type FlatImageFilterOptions added in v1.4.5

type FlatImageFilterOptions struct {
	Name       *string           `mapstructure:"name" cty:"name" hcl:"name"`
	Owner      *string           `mapstructure:"owner" cty:"owner" hcl:"owner"`
	Tags       []string          `mapstructure:"tags" cty:"tags" hcl:"tags"`
	Visibility *string           `mapstructure:"visibility" cty:"visibility" hcl:"visibility"`
	Properties map[string]string `mapstructure:"properties" cty:"properties" hcl:"properties"`
}

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

func (*FlatImageFilterOptions) HCL2Spec added in v1.4.5

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

HCL2Spec returns the hcl spec of a ImageFilterOptions. This spec is used by HCL to read the fields of ImageFilterOptions. The decoded values from this spec will then be applied to a FlatImageFilterOptions.

type ImageConfig

type ImageConfig struct {
	// The name of the resulting image.
	ImageName string `mapstructure:"image_name" required:"true"`
	// Glance metadata that will be applied to the image.
	ImageMetadata map[string]string `mapstructure:"metadata" required:"false"`
	// One of "public", "private", "shared", or "community".
	ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility" required:"false"`
	// List of members to add to the image after creation. An image member is
	// usually a project (also called the "tenant") with whom the image is
	// shared.
	ImageMembers []string `mapstructure:"image_members" required:"false"`
	// When true, perform the image accept so the members can see the image in their
	// project. This requires a user with priveleges both in the build project and
	// in the members provided. Defaults to false.
	ImageAutoAcceptMembers bool `mapstructure:"image_auto_accept_members" required:"false"`
	// Disk format of the resulting image. This option works if
	// use_blockstorage_volume is true.
	ImageDiskFormat string `mapstructure:"image_disk_format" required:"false"`
	// List of tags to add to the image after creation.
	ImageTags []string `mapstructure:"image_tags" required:"false"`
	// Minimum disk size needed to boot image, in gigabytes.
	ImageMinDisk int `mapstructure:"image_min_disk" required:"false"`
	// Skip creating the image. Useful for setting to `true` during a build test stage. Defaults to `false`.
	SkipCreateImage bool `mapstructure:"skip_create_image" required:"false"`
}

ImageConfig is for common configuration related to creating Images.

func (*ImageConfig) Prepare

func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error

type ImageFilter added in v1.3.0

type ImageFilter struct {
	// filters used to select a source_image. NOTE: This will fail unless
	// exactly one image is returned, or most_recent is set to true. Of the
	// filters described in ImageService, the following are valid:
	Filters ImageFilterOptions `mapstructure:"filters" required:"false"`
	// Selects the newest created image when true. This is most useful for
	// selecting a daily distro build.
	MostRecent bool `mapstructure:"most_recent" required:"false"`
}

func (*ImageFilter) FlatMapstructure added in v1.4.5

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

FlatMapstructure returns a new FlatImageFilter. FlatImageFilter is an auto-generated flat version of ImageFilter. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type ImageFilterOptions added in v1.3.0

type ImageFilterOptions struct {
	Name       string            `mapstructure:"name"`
	Owner      string            `mapstructure:"owner"`
	Tags       []string          `mapstructure:"tags"`
	Visibility string            `mapstructure:"visibility"`
	Properties map[string]string `mapstructure:"properties"`
}

func (*ImageFilterOptions) Build added in v1.3.0

func (f *ImageFilterOptions) Build() (*images.ListOpts, error)

func (*ImageFilterOptions) Empty added in v1.3.0

func (f *ImageFilterOptions) Empty() bool

func (*ImageFilterOptions) FlatMapstructure added in v1.4.5

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

FlatMapstructure returns a new FlatImageFilterOptions. FlatImageFilterOptions is an auto-generated flat version of ImageFilterOptions. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type RunConfig

type RunConfig struct {
	Comm communicator.Config `mapstructure:",squash"`
	// The type of interface to connect via SSH. Values useful for Rackspace
	// are "public" or "private", and the default behavior is to connect via
	// whichever is returned first from the OpenStack API.
	SSHInterface string `mapstructure:"ssh_interface" required:"false"`
	// The IP version to use for SSH connections, valid values are `4` and `6`.
	// Useful on dual stacked instances where the default behavior is to
	// connect via whichever IP address is returned first from the OpenStack
	// API.
	SSHIPVersion string `mapstructure:"ssh_ip_version" required:"false"`
	// The ID or full URL to the base image to use. This is the image that will
	// be used to launch a new server and provision it. Unless you specify
	// completely custom SSH settings, the source image must have cloud-init
	// installed so that the keypair gets assigned properly.
	SourceImage string `mapstructure:"source_image" required:"true"`
	// The name of the base image to use. This is an alternative way of
	// providing source_image and only either of them can be specified.
	SourceImageName string `mapstructure:"source_image_name" required:"true"`
	// The URL of an external base image to use. This is an alternative way of
	// providing source_image and only either of them can be specified.
	ExternalSourceImageURL string `mapstructure:"external_source_image_url" required:"true"`
	// The format of the external source image to use, e.g. qcow2, raw.
	ExternalSourceImageFormat string `mapstructure:"external_source_image_format" required:"false"`
	// Properties to set for the external source image
	ExternalSourceImageProperties map[string]string `mapstructure:"external_source_image_properties" required:"false"`
	// Filters used to populate filter options. Example:
	//
	// “`json
	//{
	//     "source_image_filter": {
	//         "filters": {
	//             "name": "ubuntu-16.04",
	//             "visibility": "protected",
	//             "owner": "d1a588cf4b0743344508dc145649372d1",
	//             "tags": ["prod", "ready"],
	//             "properties": {
	//                 "os_distro": "ubuntu"
	//             }
	//         },
	//         "most_recent": true
	//     }
	// }
	// “`
	//
	// This selects the most recent production Ubuntu 16.04 shared to you by
	// the given owner. NOTE: This will fail unless *exactly* one image is
	// returned, or `most_recent` is set to true. In the example of multiple
	// returned images, `most_recent` will cause this to succeed by selecting
	// the newest image of the returned images.
	//
	// -   `filters` (map of strings) - filters used to select a
	// `source_image`.
	//     NOTE: This will fail unless *exactly* one image is returned, or
	//     `most_recent` is set to true. Of the filters described in
	//     [ImageService](https://developer.openstack.org/api-ref/image/v2/), the
	//     following are valid:
	//
	//     -   name (string)
	//     -   owner (string)
	//     -   tags (array of strings)
	//     -   visibility (string)
	//     -   properties (map of strings to strings) (fields that can be set
	//         with `openstack image set --property key=value`)
	//
	// -   `most_recent` (boolean) - Selects the newest created image when
	// true.
	//     This is most useful for selecting a daily distro build.
	//
	// You may set use this in place of `source_image` If `source_image_filter`
	// is provided alongside `source_image`, the `source_image` will override
	// the filter. The filter will not be used in this case.
	SourceImageFilters ImageFilter `mapstructure:"source_image_filter" required:"true"`
	// The ID, name, or full URL for the desired flavor for the server to be
	// created.
	Flavor string `mapstructure:"flavor" required:"true"`
	// The availability zone to launch the server in. If this isn't specified,
	// the default enforced by your OpenStack cluster will be used. This may be
	// required for some OpenStack clusters.
	AvailabilityZone string `mapstructure:"availability_zone" required:"false"`
	// For rackspace, whether or not to wait for Rackconnect to assign the
	// machine an IP address before connecting via SSH. Defaults to false.
	RackconnectWait bool `mapstructure:"rackconnect_wait" required:"false"`
	// The ID or name of an external network that can be used for creation of a
	// new floating IP.
	FloatingIPNetwork string `mapstructure:"floating_ip_network" required:"false"`
	// The ID of the network to which the instance is attached and which should
	// be used to associate with the floating IP. This provides control over
	// the floating ip association on multi-homed instances. The association
	// otherwise depends on a first-returned-interface policy which could fail
	// if the network to which it is connected is unreachable from the floating
	// IP network.
	InstanceFloatingIPNet string `mapstructure:"instance_floating_ip_net" required:"false"`
	// A specific floating IP to assign to this instance.
	FloatingIP string `mapstructure:"floating_ip" required:"false"`
	// Whether or not to attempt to reuse existing unassigned floating ips in
	// the project before allocating a new one. Note that it is not possible to
	// safely do this concurrently, so if you are running multiple openstack
	// builds concurrently, or if other processes are assigning and using
	// floating IPs in the same openstack project while packer is running, you
	// should not set this to true. Defaults to false.
	ReuseIPs bool `mapstructure:"reuse_ips" required:"false"`
	// A list of security groups by name to add to this instance.
	SecurityGroups []string `mapstructure:"security_groups" required:"false"`
	// A list of networks by UUID to attach to this instance.
	Networks []string `mapstructure:"networks" required:"false"`
	// A list of ports by UUID to attach to this instance.
	Ports []string `mapstructure:"ports" required:"false"`
	// A list of network CIDRs to discover the network to attach to this instance.
	// The first network whose subnet is contained within any of the given CIDRs
	// is used. Ignored if either of the above two options are provided.
	NetworkDiscoveryCIDRs []string `mapstructure:"network_discovery_cidrs" required:"false"`
	// User data to apply when launching the instance. Note that you need to be
	// careful about escaping characters due to the templates being JSON. It is
	// often more convenient to use user_data_file, instead. 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.
	UserDataFile string `mapstructure:"user_data_file" required:"false"`
	// Name that is applied to the server instance created by Packer. If this
	// isn't specified, the default is same as image_name.
	InstanceName string `mapstructure:"instance_name" required:"false"`
	// Metadata that is applied to the server instance created by Packer. Also
	// called server properties in some documentation. The strings have a max
	// size of 255 bytes each.
	InstanceMetadata map[string]string `mapstructure:"instance_metadata" required:"false"`
	// Whether to force the OpenStack instance to be forcefully deleted. This
	// is useful for environments that have reclaim / soft deletion enabled. By
	// default this is false.
	ForceDelete bool `mapstructure:"force_delete" required:"false"`
	// Whether or not nova should use ConfigDrive for cloud-init metadata.
	ConfigDrive bool `mapstructure:"config_drive" required:"false"`
	// Deprecated use floating_ip_network instead.
	FloatingIPPool string `mapstructure:"floating_ip_pool" required:"false"`
	// Use Block Storage service volume for the instance root volume instead of
	// Compute service local volume (default).
	UseBlockStorageVolume bool `mapstructure:"use_blockstorage_volume" required:"false"`
	// Name of the Block Storage service volume. If this isn't specified,
	// random string will be used.
	VolumeName string `mapstructure:"volume_name" required:"false"`
	// Type of the Block Storage service volume. If this isn't specified, the
	// default enforced by your OpenStack cluster will be used.
	VolumeType string `mapstructure:"volume_type" required:"false"`
	// Size of the Block Storage service volume in GB. If this isn't specified,
	// it is set to source image min disk value (if set) or calculated from the
	// source image bytes size. Note that in some cases this needs to be
	// specified, if use_blockstorage_volume is true.
	VolumeSize int `mapstructure:"volume_size" required:"false"`
	// Availability zone of the Block Storage service volume. If omitted,
	// Compute instance availability zone will be used. If both of Compute
	// instance and Block Storage volume availability zones aren't specified,
	// the default enforced by your OpenStack cluster will be used.
	VolumeAvailabilityZone string `mapstructure:"volume_availability_zone" required:"false"`

	// Not really used, but here for BC
	OpenstackProvider string `mapstructure:"openstack_provider"`
	// *Deprecated* use `floating_ip` or `floating_ip_pool` instead.
	UseFloatingIp bool `mapstructure:"use_floating_ip" required:"false"`
	// contains filtered or unexported fields
}

RunConfig contains configuration for running an instance from a source image and details on how to access that launched image.

func (*RunConfig) Prepare

func (c *RunConfig) Prepare(ctx *interpolate.Context) []error

type StateChangeConf

type StateChangeConf struct {
	Pending   []string
	Refresh   StateRefreshFunc
	StepState multistep.StateBag
	Target    []string
}

StateChangeConf is the configuration struct used for `WaitForState`.

type StateRefreshFunc

type StateRefreshFunc func() (result interface{}, state string, progress int, err error)

StateRefreshFunc is a function type used for StateChangeConf that is responsible for refreshing the item being watched for a state change.

It returns three results. `result` is any object that will be returned as the final object after waiting for state change. This allows you to return the final updated object, for example an openstack instance after refreshing it.

`state` is the latest state of that object. And `err` is any error that may have happened while refreshing the state.

func ServerStateRefreshFunc

func ServerStateRefreshFunc(
	client *gophercloud.ServiceClient, s *servers.Server) StateRefreshFunc

ServerStateRefreshFunc returns a StateRefreshFunc that is used to watch an openstack server.

type StepAllocateIp added in v0.6.0

type StepAllocateIp struct {
	FloatingIPNetwork     string
	FloatingIP            string
	ReuseIPs              bool
	InstanceFloatingIPNet string
}

func (*StepAllocateIp) Cleanup added in v0.6.0

func (s *StepAllocateIp) Cleanup(state multistep.StateBag)

func (*StepAllocateIp) Run added in v0.6.0

type StepCreateVolume added in v1.3.0

type StepCreateVolume struct {
	UseBlockStorageVolume  bool
	VolumeName             string
	VolumeType             string
	VolumeAvailabilityZone string
	// contains filtered or unexported fields
}

func (*StepCreateVolume) Cleanup added in v1.3.0

func (s *StepCreateVolume) Cleanup(state multistep.StateBag)

func (*StepCreateVolume) Run added in v1.3.0

type StepDetachVolume added in v1.3.0

type StepDetachVolume struct {
	UseBlockStorageVolume bool
}

func (*StepDetachVolume) Cleanup added in v1.3.0

func (s *StepDetachVolume) Cleanup(multistep.StateBag)

func (*StepDetachVolume) Run added in v1.3.0

type StepDiscoverNetwork added in v1.4.5

type StepDiscoverNetwork struct {
	Networks              []string
	NetworkDiscoveryCIDRs []string
	Ports                 []string
}

func (*StepDiscoverNetwork) Cleanup added in v1.4.5

func (s *StepDiscoverNetwork) Cleanup(state multistep.StateBag)

func (*StepDiscoverNetwork) Run added in v1.4.5

type StepGetPassword added in v0.10.0

type StepGetPassword struct {
	Debug     bool
	Comm      *communicator.Config
	BuildName string
}

StepGetPassword reads the password from a booted OpenStack server and sets it on the WinRM config.

func (*StepGetPassword) Cleanup added in v0.10.0

func (s *StepGetPassword) Cleanup(multistep.StateBag)

func (*StepGetPassword) Run added in v0.10.0

type StepKeyPair

type StepKeyPair struct {
	Debug        bool
	Comm         *communicator.Config
	DebugKeyPath string
	// contains filtered or unexported fields
}

func (*StepKeyPair) Cleanup

func (s *StepKeyPair) Cleanup(state multistep.StateBag)

func (*StepKeyPair) Run

type StepLoadFlavor added in v0.8.0

type StepLoadFlavor struct {
	Flavor string
}

StepLoadFlavor gets the FlavorRef from a Flavor. It first assumes that the Flavor is a ref and verifies it. Otherwise, it tries to find the flavor by name.

func (*StepLoadFlavor) Cleanup added in v0.8.0

func (s *StepLoadFlavor) Cleanup(state multistep.StateBag)

func (*StepLoadFlavor) Run added in v0.8.0

type StepRunSourceServer

type StepRunSourceServer struct {
	Name                  string
	SecurityGroups        []string
	AvailabilityZone      string
	UserData              string
	UserDataFile          string
	ConfigDrive           bool
	InstanceMetadata      map[string]string
	UseBlockStorageVolume bool
	ForceDelete           bool
	// contains filtered or unexported fields
}

func (*StepRunSourceServer) Cleanup

func (s *StepRunSourceServer) Cleanup(state multistep.StateBag)

func (*StepRunSourceServer) Run

type StepSourceImageInfo added in v1.3.0

type StepSourceImageInfo struct {
	SourceImage                   string
	SourceImageName               string
	ExternalSourceImageURL        string
	ExternalSourceImageFormat     string
	ExternalSourceImageProperties map[string]string
	SourceImageOpts               images.ListOpts
	SourceMostRecent              bool
	SourceProperties              map[string]string
}

func (*StepSourceImageInfo) Cleanup added in v1.3.0

func (s *StepSourceImageInfo) Cleanup(state multistep.StateBag)

func (*StepSourceImageInfo) Run added in v1.3.0

type StepStopServer added in v0.8.0

type StepStopServer struct{}

func (*StepStopServer) Cleanup added in v0.8.0

func (s *StepStopServer) Cleanup(state multistep.StateBag)

func (*StepStopServer) Run added in v0.8.0

type StepWaitForRackConnect added in v0.8.0

type StepWaitForRackConnect struct {
	Wait bool
}

func (*StepWaitForRackConnect) Cleanup added in v0.8.0

func (s *StepWaitForRackConnect) Cleanup(state multistep.StateBag)

func (*StepWaitForRackConnect) Run added in v0.8.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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