Documentation ¶
Overview ¶
The googlecompute package contains a packersdk.Builder implementation that builds images for Google Compute Engine.
Index ¶
- Constants
- Variables
- func ApplyIAPTunnel(c *communicator.Config, port int) error
- func NewClientOptionGoogle(account *ServiceAccount, vaultOauth string, impersonatesa string) (option.ClientOption, error)
- func RunTunnelCommand(cmd *exec.Cmd, timeout int) error
- func SupportsIAPTunnel(c *communicator.Config) bool
- type Artifact
- type Builder
- type Config
- type CustomerEncryptionKey
- type Driver
- type DriverMock
- func (d *DriverMock) AddToInstanceMetadata(zone string, name string, metadata map[string]string) error
- func (d *DriverMock) CreateImage(name, description, family, zone, disk string, image_labels map[string]string, ...) (<-chan *Image, <-chan error)
- func (d *DriverMock) CreateOrResetWindowsPassword(instance, zone string, c *WindowsPasswordConfig) (<-chan error, error)
- func (d *DriverMock) DeleteDisk(zone, name string) (<-chan error, error)
- func (d *DriverMock) DeleteImage(name string) <-chan error
- func (d *DriverMock) DeleteInstance(zone, name string) (<-chan error, error)
- func (d *DriverMock) DeleteOSLoginSSHKey(user, fingerprint string) error
- func (d *DriverMock) GetImage(name string, fromFamily bool) (*Image, error)
- func (d *DriverMock) GetImageFromProject(project, name string, fromFamily bool) (*Image, error)
- func (d *DriverMock) GetImageFromProjects(projects []string, name string, fromFamily bool) (*Image, error)
- func (d *DriverMock) GetInstanceMetadata(zone, name, key string) (string, error)
- func (d *DriverMock) GetInternalIP(zone, name string) (string, error)
- func (d *DriverMock) GetNatIP(zone, name string) (string, error)
- func (d *DriverMock) GetSerialPortOutput(zone, name string) (string, error)
- func (d *DriverMock) GetWindowsPassword() (string, error)
- func (d *DriverMock) ImageExists(name string) bool
- func (d *DriverMock) ImportOSLoginSSHKey(user, key string) (*oslogin.LoginProfile, error)
- func (d *DriverMock) RunInstance(c *InstanceConfig) (<-chan error, error)
- func (d *DriverMock) WaitForInstance(state, zone, name string) <-chan error
- type FlatConfig
- type FlatCustomerEncryptionKey
- type FlatIAPConfig
- type GCEDriverConfig
- type IAPConfig
- type Image
- type InstanceConfig
- type OauthTokenSource
- type RetryableTunnelError
- type ServiceAccount
- type StepCheckExistingImage
- type StepCreateImage
- type StepCreateInstance
- type StepCreateWindowsPassword
- type StepImportOSLoginSSHKey
- type StepInstanceInfo
- type StepStartTunnel
- type StepTeardownInstance
- type StepWaitStartupScript
- type TunnelDriver
- type TunnelDriverLinux
- type WindowsPasswordConfig
Constants ¶
const BuilderId = "packer.googlecompute"
The unique ID for this builder.
const EnableOSLoginKey string = "enable-oslogin"
const StartupScriptKey string = "startup-script"
const StartupScriptStatusDone string = "done"
const StartupScriptStatusError string = "error"
const StartupScriptStatusKey string = "startup-script-status"
const StartupScriptStatusNotDone string = "notdone"
const StartupWrappedScriptKey string = "packer-wrapped-startup-script"
Variables ¶
var DriverScopes = []string{"https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.full_control"}
var StartupScriptLinux string = fmt.Sprintf(`#!/usr/bin/env bash echo "Packer startup script starting." RETVAL=0 BASEMETADATAURL=http://metadata.google.internal/computeMetadata/v1/instance/ GetMetadata () { echo "$(curl -f -H "Metadata-Flavor: Google" ${BASEMETADATAURL}/${1} 2> /dev/null)" } ZONE=$(basename $(GetMetadata zone)) SetMetadata () { gcloud compute instances add-metadata ${HOSTNAME} --metadata ${1}=${2} --zone ${ZONE} } STARTUPSCRIPT=$(GetMetadata attributes/%s) STARTUPSCRIPTPATH=/packer-wrapped-startup-script if [ -f "/var/log/startupscript.log" ]; then STARTUPSCRIPTLOGPATH=/var/log/startupscript.log else STARTUPSCRIPTLOGPATH=/var/log/daemon.log fi STARTUPSCRIPTLOGDEST=$(GetMetadata attributes/startup-script-log-dest) if [[ ! -z $STARTUPSCRIPT ]]; then echo "Executing user-provided startup script..." echo "${STARTUPSCRIPT}" > ${STARTUPSCRIPTPATH} chmod +x ${STARTUPSCRIPTPATH} ${STARTUPSCRIPTPATH} RETVAL=$? if [[ ! -z $STARTUPSCRIPTLOGDEST ]]; then echo "Uploading user-provided startup script log to ${STARTUPSCRIPTLOGDEST}..." gsutil -h "Content-Type:text/plain" cp ${STARTUPSCRIPTLOGPATH} ${STARTUPSCRIPTLOGDEST} fi rm ${STARTUPSCRIPTPATH} fi echo "Packer startup script done." SetMetadata %s %s exit $RETVAL `, StartupWrappedScriptKey, StartupScriptStatusKey, StartupScriptStatusDone)
var StartupScriptWindows string = ""
var TemplateFuncs = template.FuncMap{
"clean_resource_name": templateCleanImageName,
}
Functions ¶
func ApplyIAPTunnel ¶ added in v1.6.1
func ApplyIAPTunnel(c *communicator.Config, port int) error
func NewClientOptionGoogle ¶ added in v1.6.5
func NewClientOptionGoogle(account *ServiceAccount, vaultOauth string, impersonatesa string) (option.ClientOption, error)
func SupportsIAPTunnel ¶ added in v1.6.1
func SupportsIAPTunnel(c *communicator.Config) bool
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 GCE image as the result of a Packer build.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder represents a Packer Builder.
func (*Builder) ConfigSpec ¶ added in v1.5.0
func (b *Builder) ConfigSpec() hcldec.ObjectSpec
type Config ¶
type Config struct { common.PackerConfig `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"` // The JSON file containing your account credentials. Not required if you // run Packer on a GCE instance with a service account. Instructions for // creating the file or using service accounts are above. AccountFile string `mapstructure:"account_file" required:"false"` // This allows service account impersonation as per the [docs](https://cloud.google.com/iam/docs/impersonating-service-accounts). ImpersonateServiceAccount string `mapstructure:"impersonate_service_account" required:"false"` // The project ID that will be used to launch instances and store images. ProjectId string `mapstructure:"project_id" required:"true"` // Full or partial URL of the guest accelerator type. GPU accelerators can // only be used with `"on_host_maintenance": "TERMINATE"` option set. // Example: // `"projects/project_id/zones/europe-west1-b/acceleratorTypes/nvidia-tesla-k80"` AcceleratorType string `mapstructure:"accelerator_type" required:"false"` // Number of guest accelerator cards to add to the launched instance. AcceleratorCount int64 `mapstructure:"accelerator_count" required:"false"` // The name of a pre-allocated static external IP address. Note, must be // the name and not the actual IP address. Address string `mapstructure:"address" required:"false"` // If true, the default service account will not be used if // service_account_email is not specified. Set this value to true and omit // service_account_email to provision a VM with no service account. DisableDefaultServiceAccount bool `mapstructure:"disable_default_service_account" required:"false"` // The name of the disk, if unset the instance name will be used. DiskName string `mapstructure:"disk_name" required:"false"` // The size of the disk in GB. This defaults to 10, which is 10GB. DiskSizeGb int64 `mapstructure:"disk_size" required:"false"` // Type of disk used to back your instance, like pd-ssd or pd-standard. // Defaults to pd-standard. DiskType string `mapstructure:"disk_type" required:"false"` // Create a Shielded VM image with Secure Boot enabled. It helps ensure that // the system only runs authentic software by verifying the digital signature // of all boot components, and halting the boot process if signature verification // fails. [Details](https://cloud.google.com/security/shielded-cloud/shielded-vm) EnableSecureBoot bool `mapstructure:"enable_secure_boot" required:"false"` // Create a Shielded VM image with virtual trusted platform module // Measured Boot enabled. A vTPM is a virtualized trusted platform module, // which is a specialized computer chip you can use to protect objects, // like keys and certificates, that you use to authenticate access to your // system. [Details](https://cloud.google.com/security/shielded-cloud/shielded-vm) EnableVtpm bool `mapstructure:"enable_vtpm" required:"false"` // Integrity monitoring helps you understand and make decisions about the // state of your VM instances. Note: integrity monitoring relies on having // vTPM enabled. [Details](https://cloud.google.com/security/shielded-cloud/shielded-vm) EnableIntegrityMonitoring bool `mapstructure:"enable_integrity_monitoring" required:"false"` // Whether to use an IAP proxy. IAPConfig `mapstructure:",squash"` // 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"` // The unique name of the resulting image. Defaults to // `packer-{{timestamp}}`. ImageName string `mapstructure:"image_name" required:"false"` // The description of the resulting image. ImageDescription string `mapstructure:"image_description" required:"false"` // Image encryption key to apply to the created image. Possible values: // * kmsKeyName - The name of the encryption key that is stored in Google Cloud KMS. // * RawKey: - A 256-bit customer-supplied encryption key, encodes in RFC 4648 base64. // // examples: // // “`json // { // "kmsKeyName": "projects/${project}/locations/${region}/keyRings/computeEngine/cryptoKeys/computeEngine/cryptoKeyVersions/4" // } // “` // // “`hcl // image_encryption_key { // kmsKeyName = "projects/${var.project}/locations/${var.region}/keyRings/computeEngine/cryptoKeys/computeEngine/cryptoKeyVersions/4" // } // “` ImageEncryptionKey *CustomerEncryptionKey `mapstructure:"image_encryption_key" required:"false"` // The name of the image family to which the resulting image belongs. You // can create disks by specifying an image family instead of a specific // image name. The image family always returns its latest image that is not // deprecated. ImageFamily string `mapstructure:"image_family" required:"false"` // Key/value pair labels to apply to the created image. ImageLabels map[string]string `mapstructure:"image_labels" required:"false"` // Licenses to apply to the created image. ImageLicenses []string `mapstructure:"image_licenses" required:"false"` // Storage location, either regional or multi-regional, where snapshot // content is to be stored and only accepts 1 value. Always defaults to a nearby regional or multi-regional // location. // // multi-regional example: // // “`json // { // "image_storage_locations": ["us"] // } // “` // regional example: // // “`json // { // "image_storage_locations": ["us-east1"] // } // “` ImageStorageLocations []string `mapstructure:"image_storage_locations" required:"false"` // A name to give the launched instance. Beware that this must be unique. // Defaults to `packer-{{uuid}}`. InstanceName string `mapstructure:"instance_name" required:"false"` // Key/value pair labels to apply to the launched instance. Labels map[string]string `mapstructure:"labels" required:"false"` // The machine type. Defaults to "n1-standard-1". MachineType string `mapstructure:"machine_type" required:"false"` // Metadata applied to the launched instance. // All metadata configuration values are expected to be of type string. // Google metadata options that take a value of `TRUE` or `FALSE` should be // set as a string (i.e `"TRUE"` `"FALSE"` or `"true"` `"false"`). Metadata map[string]string `mapstructure:"metadata" required:"false"` // Metadata applied to the launched instance. Values are files. MetadataFiles map[string]string `mapstructure:"metadata_files"` // A Minimum CPU Platform for VM Instance. Availability and default CPU // platforms vary across zones, based on the hardware available in each GCP // zone. // [Details](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) MinCpuPlatform string `mapstructure:"min_cpu_platform" required:"false"` // The Google Compute network id or URL to use for the launched instance. // Defaults to "default". If the value is not a URL, it will be // interpolated to // `projects/((network_project_id))/global/networks/((network))`. This value // is not required if a subnet is specified. Network string `mapstructure:"network" required:"false"` // The project ID for the network and subnetwork to use for launched // instance. Defaults to project_id. NetworkProjectId string `mapstructure:"network_project_id" required:"false"` // If true, the instance will not have an external IP. use_internal_ip must // be true if this property is true. OmitExternalIP bool `mapstructure:"omit_external_ip" required:"false"` // Sets Host Maintenance Option. Valid choices are `MIGRATE` and // `TERMINATE`. Please see [GCE Instance Scheduling // Options](https://cloud.google.com/compute/docs/instances/setting-instance-scheduling-options), // as not all machine\_types support `MIGRATE` (i.e. machines with GPUs). // If preemptible is true this can only be `TERMINATE`. If preemptible is // false, it defaults to `MIGRATE` OnHostMaintenance string `mapstructure:"on_host_maintenance" required:"false"` // If true, launch a preemptible instance. Preemptible bool `mapstructure:"preemptible" required:"false"` // The time to wait for instance state changes. Defaults to "5m". StateTimeout time.Duration `mapstructure:"state_timeout" required:"false"` // The region in which to launch the instance. Defaults to the region // hosting the specified zone. Region string `mapstructure:"region" required:"false"` // The service account scopes for launched // instance. Defaults to: // // “`json // [ // "https://www.googleapis.com/auth/userinfo.email", // "https://www.googleapis.com/auth/compute", // "https://www.googleapis.com/auth/devstorage.full_control" // ] // “` Scopes []string `mapstructure:"scopes" required:"false"` // The service account to be used for launched instance. Defaults to the // project's default service account unless disable_default_service_account // is true. ServiceAccountEmail string `mapstructure:"service_account_email" required:"false"` // The source image to use to create the new image from. You can also // specify source_image_family instead. If both source_image and // source_image_family are specified, source_image takes precedence. // Example: "debian-8-jessie-v20161027" SourceImage string `mapstructure:"source_image" required:"true"` // The source image family to use to create the new image from. The image // family always returns its latest image that is not deprecated. Example: // "debian-8". SourceImageFamily string `mapstructure:"source_image_family" required:"true"` // A list of project IDs to search for the source image. Packer will search the first // project ID in the list first, and fall back to the next in the list, until it finds the source image. SourceImageProjectId []string `mapstructure:"source_image_project_id" required:"false"` // The path to a startup script to run on the launched instance from which the image will // be made. When set, the contents of the startup script file will be added to the instance metadata // under the `"startup_script"` metadata property. See [Providing startup script contents directly](https://cloud.google.com/compute/docs/startupscript#providing_startup_script_contents_directly) for more details. // // When using `startup_script_file` the following rules apply: // - The contents of the script file will overwrite the value of the `"startup_script"` metadata property at runtime. // - The contents of the script file will be wrapped in Packer's startup script wrapper, unless `wrap_startup_script` is disabled. See `wrap_startup_script` for more details. // - Not supported by Windows instances. See [Startup Scripts for Windows](https://cloud.google.com/compute/docs/startupscript#providing_a_startup_script_for_windows_instances) for more details. StartupScriptFile string `mapstructure:"startup_script_file" required:"false"` // The time to wait for windows password to be retrieved. Defaults to "3m". WindowsPasswordTimeout time.Duration `mapstructure:"windows_password_timeout" required:"false"` // For backwards compatibility this option defaults to `"true"` in the future it will default to `"false"`. // If "true", the contents of `startup_script_file` or `"startup_script"` in the instance metadata // is wrapped in a Packer specific script that tracks the execution and completion of the provided // startup script. The wrapper ensures that the builder will not continue until the startup script has been executed. // - The use of the wrapped script file requires that the user or service account // running the build has the compute.instance.Metadata role. WrapStartupScriptFile config.Trilean `mapstructure:"wrap_startup_script" required:"false"` // The Google Compute subnetwork id or URL to use for the launched // instance. Only required if the network has been created with custom // subnetting. Note, the region of the subnetwork must match the region or // zone in which the VM is launched. If the value is not a URL, it will be // interpolated to // `projects/((network_project_id))/regions/((region))/subnetworks/((subnetwork))` Subnetwork string `mapstructure:"subnetwork" required:"false"` // Assign network tags to apply firewall rules to VM instance. Tags []string `mapstructure:"tags" required:"false"` // If true, use the instance's internal IP instead of its external IP // during building. UseInternalIP bool `mapstructure:"use_internal_ip" required:"false"` // If true, OSLogin will be used to manage SSH access to the compute instance by // dynamically importing a temporary SSH key to the Google account's login profile, // and setting the `enable-oslogin` to `TRUE` in the instance metadata. // Optionally, `use_os_login` can be used with an existing `ssh_username` and `ssh_private_key_file` // if a SSH key has already been added to the Google account's login profile - See [Adding SSH Keys](https://cloud.google.com/compute/docs/instances/managing-instance-access#add_oslogin_keys). // // SSH keys can be added to an individual user account // //“`shell-session // $ gcloud compute os-login ssh-keys add --key-file=/home/user/.ssh/my-key.pub // // $ gcloud compute os-login describe-profile //PosixAccounts: //- accountId: <project-id> // gid: '34567890754' // homeDirectory: /home/user_example_com // ... // primary: true // uid: '2504818925' // username: /home/user_example_com //sshPublicKeys: // 000000000000000000000000000000000000000000000000000000000000000a: // fingerprint: 000000000000000000000000000000000000000000000000000000000000000a //“` // // Or SSH keys can be added to an associated service account //“`shell-session // $ gcloud auth activate-service-account --key-file=<path to service account credentials file (e.g account.json)> // $ gcloud compute os-login ssh-keys add --key-file=/home/user/.ssh/my-key.pub // // $ gcloud compute os-login describe-profile //PosixAccounts: //- accountId: <project-id> // gid: '34567890754' // homeDirectory: /home/sa_000000000000000000000 // ... // primary: true // uid: '2504818925' // username: sa_000000000000000000000 //sshPublicKeys: // 000000000000000000000000000000000000000000000000000000000000000a: // fingerprint: 000000000000000000000000000000000000000000000000000000000000000a //“` UseOSLogin bool `mapstructure:"use_os_login" required:"false"` // Can be set instead of account_file. If set, this builder will use // HashiCorp Vault to generate an Oauth token for authenticating against // Google Cloud. The value should be the path of the token generator // within vault. // For information on how to configure your Vault + GCP engine to produce // Oauth tokens, see https://www.vaultproject.io/docs/auth/gcp // You must have the environment variables VAULT_ADDR and VAULT_TOKEN set, // along with any other relevant variables for accessing your vault // instance. For more information, see the Vault docs: // https://www.vaultproject.io/docs/commands/#environment-variables // Example:`"vault_gcp_oauth_engine": "gcp/token/my-project-editor",` VaultGCPOauthEngine string `mapstructure:"vault_gcp_oauth_engine"` // The time to wait between the creation of the instance used to create the image, // and the addition of SSH configuration, including SSH keys, to that instance. // The delay is intended to protect packer from anything in the instance boot // sequence that has potential to disrupt the creation of SSH configuration // (e.g. SSH user creation, SSH key creation) on the instance. // Note: All other instance metadata, including startup scripts, are still added to the instance // during it's creation. // Example value: `5m`. WaitToAddSSHKeys time.Duration `mapstructure:"wait_to_add_ssh_keys"` // The zone in which to launch the instance used to create the image. // Example: "us-central1-a" Zone string `mapstructure:"zone" required:"true"` // contains filtered or unexported fields }
Config is the configuration structure for the GCE builder. It stores both the publicly settable state as well as the privately generated state of the config object.
func (*Config) FlatMapstructure ¶ added in v1.4.5
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 CustomerEncryptionKey ¶ added in v1.4.5
type CustomerEncryptionKey struct { // KmsKeyName: The name of the encryption key that is stored in Google // Cloud KMS. KmsKeyName string `mapstructure:"kmsKeyName" json:"kmsKeyName,omitempty"` // RawKey: Specifies a 256-bit customer-supplied encryption key, encoded // in RFC 4648 base64 to either encrypt or decrypt this resource. RawKey string `mapstructure:"rawKey" json:"rawKey,omitempty"` }
func (*CustomerEncryptionKey) ComputeType ¶ added in v1.4.5
func (k *CustomerEncryptionKey) ComputeType() *compute.CustomerEncryptionKey
func (*CustomerEncryptionKey) FlatMapstructure ¶ added in v1.4.5
func (*CustomerEncryptionKey) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatCustomerEncryptionKey. FlatCustomerEncryptionKey is an auto-generated flat version of CustomerEncryptionKey. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type Driver ¶
type Driver interface { // CreateImage creates an image from the given disk in Google Compute // Engine. CreateImage(name, description, family, zone, disk string, image_labels map[string]string, image_licenses []string, image_encryption_key *compute.CustomerEncryptionKey, imageStorageLocation []string) (<-chan *Image, <-chan error) // DeleteImage deletes the image with the given name. DeleteImage(name string) <-chan error // DeleteInstance deletes the given instance, keeping the boot disk. DeleteInstance(zone, name string) (<-chan error, error) // DeleteDisk deletes the disk with the given name. DeleteDisk(zone, name string) (<-chan error, error) // GetImage gets an image; tries the default and public projects. If // fromFamily is true, name designates an image family instead of a // particular image. GetImage(name string, fromFamily bool) (*Image, error) // GetImageFromProject gets an image from a specific projects. // Returns the image from the first project in slice it can find one // If fromFamily is true, name designates an image family instead of a particular image. GetImageFromProjects(project []string, name string, fromFamily bool) (*Image, error) // GetImageFromProject gets an image from a specific project. If fromFamily // is true, name designates an image family instead of a particular image. GetImageFromProject(project, name string, fromFamily bool) (*Image, error) // GetInstanceMetadata gets a metadata variable for the instance, name. GetInstanceMetadata(zone, name, key string) (string, error) // GetInternalIP gets the GCE-internal IP address for the instance. GetInternalIP(zone, name string) (string, error) // GetNatIP gets the NAT IP address for the instance. GetNatIP(zone, name string) (string, error) // GetSerialPortOutput gets the Serial Port contents for the instance. GetSerialPortOutput(zone, name string) (string, error) // ImageExists returns true if the specified image exists. If an error // occurs calling the API, this method returns false. ImageExists(name string) bool // RunInstance takes the given config and launches an instance. RunInstance(*InstanceConfig) (<-chan error, error) // WaitForInstance waits for an instance to reach the given state. WaitForInstance(state, zone, name string) <-chan error // CreateOrResetWindowsPassword creates or resets the password for a user on an Windows instance. CreateOrResetWindowsPassword(zone, name string, config *WindowsPasswordConfig) (<-chan error, error) // ImportOSLoginSSHKey imports SSH public key for OSLogin. ImportOSLoginSSHKey(user, sshPublicKey string) (*oslogin.LoginProfile, error) // DeleteOSLoginSSHKey deletes the SSH public key for OSLogin with the given key. DeleteOSLoginSSHKey(user, fingerprint string) error // Add to the instance metadata for the existing instance AddToInstanceMetadata(zone string, name string, metadata map[string]string) error }
Driver is the interface that has to be implemented to communicate with GCE. The Driver interface exists mostly to allow a mock implementation to be used to test the steps.
func NewDriverGCE ¶
func NewDriverGCE(config GCEDriverConfig) (Driver, error)
type DriverMock ¶
type DriverMock struct { CreateImageName string CreateImageDesc string CreateImageFamily string CreateImageEncryptionKey *compute.CustomerEncryptionKey CreateImageLabels map[string]string CreateImageLicenses []string CreateImageStorageLocations []string CreateImageZone string CreateImageDisk string CreateImageResultProjectId string CreateImageResultSelfLink string CreateImageResultSizeGb int64 CreateImageErrCh <-chan error CreateImageResultCh <-chan *Image DeleteImageName string DeleteImageErrCh <-chan error DeleteInstanceZone string DeleteInstanceName string DeleteInstanceErrCh <-chan error DeleteInstanceErr error DeleteDiskZone string DeleteDiskName string DeleteDiskErrCh <-chan error DeleteDiskErr error GetImageName string GetImageSourceProjects []string GetImageFromFamily bool GetImageResult *Image GetImageErr error GetImageFromProjectProject string GetImageFromProjectName string GetImageFromProjectFromFamily bool GetImageFromProjectResult *Image GetImageFromProjectErr error GetInstanceMetadataZone string GetInstanceMetadataName string GetInstanceMetadataKey string GetInstanceMetadataResult string GetInstanceMetadataErr error GetNatIPZone string GetNatIPName string GetNatIPResult string GetNatIPErr error GetInternalIPZone string GetInternalIPName string GetInternalIPResult string GetInternalIPErr error GetSerialPortOutputZone string GetSerialPortOutputName string GetSerialPortOutputResult string GetSerialPortOutputErr error ImageExistsName string ImageExistsResult bool RunInstanceConfig *InstanceConfig RunInstanceErrCh <-chan error RunInstanceErr error CreateOrResetWindowsPasswordZone string CreateOrResetWindowsPasswordInstance string CreateOrResetWindowsPasswordConfig *WindowsPasswordConfig CreateOrResetWindowsPasswordErr error CreateOrResetWindowsPasswordErrCh <-chan error WaitForInstanceState string WaitForInstanceZone string WaitForInstanceName string WaitForInstanceErrCh <-chan error AddToInstanceMetadataZone string AddToInstanceMetadataName string AddToInstanceMetadataKVPairs map[string]string AddToInstanceMetadataErrCh <-chan error AddToInstanceMetadataErr error }
DriverMock is a Driver implementation that is a mocked out so that it can be used for tests.
func (*DriverMock) AddToInstanceMetadata ¶ added in v1.6.6
func (*DriverMock) CreateImage ¶
func (d *DriverMock) CreateImage(name, description, family, zone, disk string, image_labels map[string]string, image_licenses []string, image_encryption_key *compute.CustomerEncryptionKey, imageStorageLocations []string) (<-chan *Image, <-chan error)
func (*DriverMock) CreateOrResetWindowsPassword ¶ added in v0.11.0
func (d *DriverMock) CreateOrResetWindowsPassword(instance, zone string, c *WindowsPasswordConfig) (<-chan error, error)
func (*DriverMock) DeleteDisk ¶ added in v0.7.5
func (d *DriverMock) DeleteDisk(zone, name string) (<-chan error, error)
func (*DriverMock) DeleteImage ¶
func (d *DriverMock) DeleteImage(name string) <-chan error
func (*DriverMock) DeleteInstance ¶
func (d *DriverMock) DeleteInstance(zone, name string) (<-chan error, error)
func (*DriverMock) DeleteOSLoginSSHKey ¶ added in v1.6.1
func (d *DriverMock) DeleteOSLoginSSHKey(user, fingerprint string) error
func (*DriverMock) GetImage ¶ added in v0.11.0
func (d *DriverMock) GetImage(name string, fromFamily bool) (*Image, error)
func (*DriverMock) GetImageFromProject ¶ added in v0.11.0
func (d *DriverMock) GetImageFromProject(project, name string, fromFamily bool) (*Image, error)
func (*DriverMock) GetImageFromProjects ¶ added in v1.5.6
func (*DriverMock) GetInstanceMetadata ¶ added in v0.11.0
func (d *DriverMock) GetInstanceMetadata(zone, name, key string) (string, error)
func (*DriverMock) GetInternalIP ¶ added in v0.8.0
func (d *DriverMock) GetInternalIP(zone, name string) (string, error)
func (*DriverMock) GetSerialPortOutput ¶ added in v0.11.0
func (d *DriverMock) GetSerialPortOutput(zone, name string) (string, error)
func (*DriverMock) GetWindowsPassword ¶ added in v0.11.0
func (d *DriverMock) GetWindowsPassword() (string, error)
func (*DriverMock) ImageExists ¶ added in v0.7.5
func (d *DriverMock) ImageExists(name string) bool
func (*DriverMock) ImportOSLoginSSHKey ¶ added in v1.6.1
func (d *DriverMock) ImportOSLoginSSHKey(user, key string) (*oslogin.LoginProfile, error)
func (*DriverMock) RunInstance ¶
func (d *DriverMock) RunInstance(c *InstanceConfig) (<-chan error, error)
func (*DriverMock) WaitForInstance ¶
func (d *DriverMock) WaitForInstance(state, zone, name string) <-chan error
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"` 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"` AccountFile *string `mapstructure:"account_file" required:"false" cty:"account_file" hcl:"account_file"` ImpersonateServiceAccount *string `` /* 127-byte string literal not displayed */ ProjectId *string `mapstructure:"project_id" required:"true" cty:"project_id" hcl:"project_id"` AcceleratorType *string `mapstructure:"accelerator_type" required:"false" cty:"accelerator_type" hcl:"accelerator_type"` AcceleratorCount *int64 `mapstructure:"accelerator_count" required:"false" cty:"accelerator_count" hcl:"accelerator_count"` Address *string `mapstructure:"address" required:"false" cty:"address" hcl:"address"` DisableDefaultServiceAccount *bool `` /* 139-byte string literal not displayed */ DiskName *string `mapstructure:"disk_name" required:"false" cty:"disk_name" hcl:"disk_name"` DiskSizeGb *int64 `mapstructure:"disk_size" required:"false" cty:"disk_size" hcl:"disk_size"` DiskType *string `mapstructure:"disk_type" required:"false" cty:"disk_type" hcl:"disk_type"` EnableSecureBoot *bool `mapstructure:"enable_secure_boot" required:"false" cty:"enable_secure_boot" hcl:"enable_secure_boot"` EnableVtpm *bool `mapstructure:"enable_vtpm" required:"false" cty:"enable_vtpm" hcl:"enable_vtpm"` EnableIntegrityMonitoring *bool `` /* 127-byte string literal not displayed */ IAP *bool `mapstructure:"use_iap" required:"false" cty:"use_iap" hcl:"use_iap"` IAPLocalhostPort *int `mapstructure:"iap_localhost_port" cty:"iap_localhost_port" hcl:"iap_localhost_port"` IAPHashBang *string `mapstructure:"iap_hashbang" required:"false" cty:"iap_hashbang" hcl:"iap_hashbang"` IAPExt *string `mapstructure:"iap_ext" required:"false" cty:"iap_ext" hcl:"iap_ext"` IAPTunnelLaunchWait *int `mapstructure:"iap_tunnel_launch_wait" required:"false" cty:"iap_tunnel_launch_wait" hcl:"iap_tunnel_launch_wait"` SkipCreateImage *bool `mapstructure:"skip_create_image" required:"false" cty:"skip_create_image" hcl:"skip_create_image"` ImageName *string `mapstructure:"image_name" required:"false" cty:"image_name" hcl:"image_name"` ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description" hcl:"image_description"` ImageEncryptionKey *FlatCustomerEncryptionKey `mapstructure:"image_encryption_key" required:"false" cty:"image_encryption_key" hcl:"image_encryption_key"` ImageFamily *string `mapstructure:"image_family" required:"false" cty:"image_family" hcl:"image_family"` ImageLabels map[string]string `mapstructure:"image_labels" required:"false" cty:"image_labels" hcl:"image_labels"` ImageLicenses []string `mapstructure:"image_licenses" required:"false" cty:"image_licenses" hcl:"image_licenses"` ImageStorageLocations []string `mapstructure:"image_storage_locations" required:"false" cty:"image_storage_locations" hcl:"image_storage_locations"` InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"` Labels map[string]string `mapstructure:"labels" required:"false" cty:"labels" hcl:"labels"` MachineType *string `mapstructure:"machine_type" required:"false" cty:"machine_type" hcl:"machine_type"` Metadata map[string]string `mapstructure:"metadata" required:"false" cty:"metadata" hcl:"metadata"` MetadataFiles map[string]string `mapstructure:"metadata_files" cty:"metadata_files" hcl:"metadata_files"` MinCpuPlatform *string `mapstructure:"min_cpu_platform" required:"false" cty:"min_cpu_platform" hcl:"min_cpu_platform"` Network *string `mapstructure:"network" required:"false" cty:"network" hcl:"network"` NetworkProjectId *string `mapstructure:"network_project_id" required:"false" cty:"network_project_id" hcl:"network_project_id"` OmitExternalIP *bool `mapstructure:"omit_external_ip" required:"false" cty:"omit_external_ip" hcl:"omit_external_ip"` OnHostMaintenance *string `mapstructure:"on_host_maintenance" required:"false" cty:"on_host_maintenance" hcl:"on_host_maintenance"` Preemptible *bool `mapstructure:"preemptible" required:"false" cty:"preemptible" hcl:"preemptible"` StateTimeout *string `mapstructure:"state_timeout" required:"false" cty:"state_timeout" hcl:"state_timeout"` Region *string `mapstructure:"region" required:"false" cty:"region" hcl:"region"` Scopes []string `mapstructure:"scopes" required:"false" cty:"scopes" hcl:"scopes"` ServiceAccountEmail *string `mapstructure:"service_account_email" required:"false" cty:"service_account_email" hcl:"service_account_email"` SourceImage *string `mapstructure:"source_image" required:"true" cty:"source_image" hcl:"source_image"` SourceImageFamily *string `mapstructure:"source_image_family" required:"true" cty:"source_image_family" hcl:"source_image_family"` SourceImageProjectId []string `mapstructure:"source_image_project_id" required:"false" cty:"source_image_project_id" hcl:"source_image_project_id"` StartupScriptFile *string `mapstructure:"startup_script_file" required:"false" cty:"startup_script_file" hcl:"startup_script_file"` WindowsPasswordTimeout *string `mapstructure:"windows_password_timeout" required:"false" cty:"windows_password_timeout" hcl:"windows_password_timeout"` WrapStartupScriptFile *bool `mapstructure:"wrap_startup_script" required:"false" cty:"wrap_startup_script" hcl:"wrap_startup_script"` Subnetwork *string `mapstructure:"subnetwork" required:"false" cty:"subnetwork" hcl:"subnetwork"` Tags []string `mapstructure:"tags" required:"false" cty:"tags" hcl:"tags"` UseInternalIP *bool `mapstructure:"use_internal_ip" required:"false" cty:"use_internal_ip" hcl:"use_internal_ip"` UseOSLogin *bool `mapstructure:"use_os_login" required:"false" cty:"use_os_login" hcl:"use_os_login"` VaultGCPOauthEngine *string `mapstructure:"vault_gcp_oauth_engine" cty:"vault_gcp_oauth_engine" hcl:"vault_gcp_oauth_engine"` WaitToAddSSHKeys *string `mapstructure:"wait_to_add_ssh_keys" cty:"wait_to_add_ssh_keys" hcl:"wait_to_add_ssh_keys"` Zone *string `mapstructure:"zone" required:"true" cty:"zone" hcl:"zone"` }
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatCustomerEncryptionKey ¶ added in v1.4.5
type FlatCustomerEncryptionKey struct { KmsKeyName *string `mapstructure:"kmsKeyName" json:"kmsKeyName,omitempty" cty:"kmsKeyName" hcl:"kmsKeyName"` RawKey *string `mapstructure:"rawKey" json:"rawKey,omitempty" cty:"rawKey" hcl:"rawKey"` }
FlatCustomerEncryptionKey is an auto-generated flat version of CustomerEncryptionKey. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatCustomerEncryptionKey) HCL2Spec ¶ added in v1.4.5
func (*FlatCustomerEncryptionKey) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a CustomerEncryptionKey. This spec is used by HCL to read the fields of CustomerEncryptionKey. The decoded values from this spec will then be applied to a FlatCustomerEncryptionKey.
type FlatIAPConfig ¶ added in v1.6.0
type FlatIAPConfig struct { IAP *bool `mapstructure:"use_iap" required:"false" cty:"use_iap" hcl:"use_iap"` IAPLocalhostPort *int `mapstructure:"iap_localhost_port" cty:"iap_localhost_port" hcl:"iap_localhost_port"` IAPHashBang *string `mapstructure:"iap_hashbang" required:"false" cty:"iap_hashbang" hcl:"iap_hashbang"` IAPExt *string `mapstructure:"iap_ext" required:"false" cty:"iap_ext" hcl:"iap_ext"` IAPTunnelLaunchWait *int `mapstructure:"iap_tunnel_launch_wait" required:"false" cty:"iap_tunnel_launch_wait" hcl:"iap_tunnel_launch_wait"` }
FlatIAPConfig is an auto-generated flat version of IAPConfig. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type GCEDriverConfig ¶ added in v1.6.5
type IAPConfig ¶ added in v1.6.0
type IAPConfig struct { // Whether to use an IAP proxy. // Prerequisites and limitations for using IAP: // - You must manually enable the IAP API in the Google Cloud console. // - You must have the gcloud sdk installed on the computer running Packer. // - You must be using a Service Account with a credentials file (using the // account_file option in the Packer template) // - You must add the given service account to project level IAP permissions // in https://console.cloud.google.com/security/iap. To do so, click // "project" > "SSH and TCP resoures" > "All Tunnel Resources" > // "Add Member". Then add your service account and choose the role // "IAP-secured Tunnel User" and add any conditions you may care about. IAP bool `mapstructure:"use_iap" required:"false"` // Which port to connect the local end of the IAM localhost proxy to. If // left blank, Packer will choose a port for you from available ports. IAPLocalhostPort int `mapstructure:"iap_localhost_port"` // What "hashbang" to use to invoke script that sets up gcloud. // Default: "/bin/sh" IAPHashBang string `mapstructure:"iap_hashbang" required:"false"` // What file extension to use for script that sets up gcloud. // Default: ".sh" IAPExt string `mapstructure:"iap_ext" required:"false"` // How long to wait, in seconds, before assuming a tunnel launch was // successful. Defaults to 30 seconds for SSH or 40 seconds for WinRM. IAPTunnelLaunchWait int `mapstructure:"iap_tunnel_launch_wait" required:"false"` }
StepStartTunnel represents a Packer build step that launches an IAP tunnel
func (*IAPConfig) FlatMapstructure ¶ added in v1.6.0
FlatMapstructure returns a new FlatIAPConfig. FlatIAPConfig is an auto-generated flat version of IAPConfig. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type Image ¶ added in v0.7.0
type Image struct { GuestOsFeatures []*compute.GuestOsFeature Labels map[string]string Licenses []string Name string ProjectId string SelfLink string SizeGb int64 }
func (*Image) IsSecureBootCompatible ¶ added in v1.5.6
type InstanceConfig ¶
type InstanceConfig struct { AcceleratorType string AcceleratorCount int64 Address string Description string DisableDefaultServiceAccount bool DiskSizeGb int64 DiskType string EnableSecureBoot bool EnableVtpm bool EnableIntegrityMonitoring bool Image *Image Labels map[string]string MachineType string Metadata map[string]string MinCpuPlatform string Name string Network string NetworkProjectId string OmitExternalIP bool OnHostMaintenance string Preemptible bool Region string ServiceAccountEmail string Scopes []string Subnetwork string Tags []string Zone string }
type OauthTokenSource ¶ added in v1.4.4
type OauthTokenSource struct {
Path string
}
Define a TokenSource that gets tokens from Vault
type RetryableTunnelError ¶ added in v1.6.0
type RetryableTunnelError struct {
// contains filtered or unexported fields
}
func (RetryableTunnelError) Error ¶ added in v1.6.0
func (e RetryableTunnelError) Error() string
type ServiceAccount ¶ added in v1.6.5
type ServiceAccount struct {
// contains filtered or unexported fields
}
func ProcessAccountFile ¶ added in v0.11.0
func ProcessAccountFile(text string) (*ServiceAccount, error)
ProcessAccountFile will return a ServiceAccount for the JSON account file stored in text. Otherwise it will return an error if text does not look or reference a valid account file.
type StepCheckExistingImage ¶ added in v0.7.5
type StepCheckExistingImage int
StepCheckExistingImage represents a Packer build step that checks if the target image already exists, and aborts immediately if so.
func (*StepCheckExistingImage) Cleanup ¶ added in v0.7.5
func (s *StepCheckExistingImage) Cleanup(state multistep.StateBag)
Cleanup.
func (*StepCheckExistingImage) Run ¶ added in v0.7.5
func (s *StepCheckExistingImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that checks if the image already exists.
type StepCreateImage ¶
type StepCreateImage int
StepCreateImage represents a Packer build step that creates GCE machine images.
func (*StepCreateImage) Cleanup ¶
func (s *StepCreateImage) Cleanup(state multistep.StateBag)
Cleanup.
func (*StepCreateImage) Run ¶
func (s *StepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that creates a GCE machine image.
The image is created from the persistent disk used by the instance. The instance must be deleted and the disk retained before doing this step.
type StepCreateInstance ¶
type StepCreateInstance struct {
Debug bool
}
StepCreateInstance represents a Packer build step that creates GCE instances.
func (*StepCreateInstance) Cleanup ¶
func (s *StepCreateInstance) Cleanup(state multistep.StateBag)
Cleanup destroys the GCE instance created during the image creation process.
func (*StepCreateInstance) Run ¶
func (s *StepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that creates a GCE instance.
type StepCreateWindowsPassword ¶ added in v0.11.0
StepCreateWindowsPassword represents a Packer build step that sets the windows password on a Windows GCE instance.
func (*StepCreateWindowsPassword) Cleanup ¶ added in v0.11.0
func (s *StepCreateWindowsPassword) Cleanup(state multistep.StateBag)
Nothing to clean up. The windows password is only created on the single instance.
func (*StepCreateWindowsPassword) Run ¶ added in v0.11.0
func (s *StepCreateWindowsPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that sets the windows password on a Windows GCE instance.
type StepImportOSLoginSSHKey ¶ added in v1.6.1
type StepImportOSLoginSSHKey struct { Debug bool TokeninfoFunc func(context.Context) (*oauth2.Tokeninfo, error) // contains filtered or unexported fields }
StepImportOSLoginSSHKey imports a temporary SSH key pair into a GCE login profile.
func (*StepImportOSLoginSSHKey) Cleanup ¶ added in v1.6.1
func (s *StepImportOSLoginSSHKey) Cleanup(state multistep.StateBag)
Cleanup the SSH Key that we added to the POSIX account
func (*StepImportOSLoginSSHKey) Run ¶ added in v1.6.1
func (s *StepImportOSLoginSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that generates SSH key pairs. The key pairs are added to the ssh config
type StepInstanceInfo ¶
type StepInstanceInfo struct {
Debug bool
}
stepInstanceInfo represents a Packer build step that gathers GCE instance info.
func (*StepInstanceInfo) Cleanup ¶
func (s *StepInstanceInfo) Cleanup(state multistep.StateBag)
Cleanup.
func (*StepInstanceInfo) Run ¶
func (s *StepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that gathers GCE instance info. This adds "instance_ip" to the multistep state.
type StepStartTunnel ¶ added in v1.6.0
type StepStartTunnel struct { IAPConf *IAPConfig CommConf *communicator.Config AccountFile string ImpersonateAccount string ProjectId string // contains filtered or unexported fields }
func (*StepStartTunnel) Cleanup ¶ added in v1.6.0
func (s *StepStartTunnel) Cleanup(state multistep.StateBag)
Cleanup stops the IAP tunnel and cleans up processes.
func (*StepStartTunnel) ConfigureLocalHostPort ¶ added in v1.6.0
func (s *StepStartTunnel) ConfigureLocalHostPort(ctx context.Context) error
func (*StepStartTunnel) Run ¶ added in v1.6.0
func (s *StepStartTunnel) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that creates an IAP tunnel.
type StepTeardownInstance ¶ added in v0.7.5
type StepTeardownInstance struct {
Debug bool
}
StepTeardownInstance represents a Packer build step that tears down GCE instances.
func (*StepTeardownInstance) Cleanup ¶ added in v0.7.5
func (s *StepTeardownInstance) Cleanup(state multistep.StateBag)
Deleting the instance does not remove the boot disk. This cleanup removes the disk.
func (*StepTeardownInstance) Run ¶ added in v0.7.5
func (s *StepTeardownInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes the Packer build step that tears down a GCE instance.
type StepWaitStartupScript ¶ added in v0.12.0
type StepWaitStartupScript int
func (*StepWaitStartupScript) Cleanup ¶ added in v0.12.0
func (s *StepWaitStartupScript) Cleanup(state multistep.StateBag)
Cleanup.
func (*StepWaitStartupScript) Run ¶ added in v0.12.0
func (s *StepWaitStartupScript) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run reads the instance metadata and looks for the log entry indicating the startup script finished.
type TunnelDriver ¶ added in v1.6.0
func NewTunnelDriver ¶ added in v1.6.0
func NewTunnelDriver() TunnelDriver
type TunnelDriverLinux ¶ added in v1.6.0
type TunnelDriverLinux struct {
// contains filtered or unexported fields
}
func (*TunnelDriverLinux) StartTunnel ¶ added in v1.6.0
func (*TunnelDriverLinux) StopTunnel ¶ added in v1.6.0
func (t *TunnelDriverLinux) StopTunnel()
type WindowsPasswordConfig ¶ added in v0.11.0
type WindowsPasswordConfig struct { UserName string `json:"userName"` Modulus string `json:"modulus"` Exponent string `json:"exponent"` Email string `json:"email"` ExpireOn time.Time `json:"expireOn"` WindowsPasswordTimeout time.Duration `json:"timeout"` // contains filtered or unexported fields }
WindowsPasswordConfig is the data structure that GCE needs to encrypt the created windows password.
Source Files ¶
- account.go
- artifact.go
- builder.go
- config.go
- config.hcl2spec.go
- driver.go
- driver_gce.go
- driver_mock.go
- image.go
- networking.go
- startup.go
- step_check_existing_image.go
- step_create_image.go
- step_create_instance.go
- step_create_windows_password.go
- step_import_os_login_ssh_key.go
- step_instance_info.go
- step_start_tunnel.go
- step_start_tunnel.hcl2spec.go
- step_teardown_instance.go
- step_wait_startup_script.go
- template_funcs.go
- tunnel_driver.go
- winrm.go