diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index e174b27c1..c9433be19 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -34,9 +34,9 @@ type Config struct { // 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. + // only be used with `"on_host_maintenance": "TERMINATE"` option set. // Example: - // "projects/project_id/zones/europe-west1-b/acceleratorTypes/nvidia-tesla-k80" + // `"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"` @@ -60,6 +60,16 @@ type Config struct { // 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. + // + // example: + // + // ``` json + // { + // "kmsKeyName": "projects/${project}/locations/${region}/keyRings/computeEngine/cryptoKeys/computeEngine/cryptoKeyVersions/4" + // } + // ``` ImageEncryptionKey *compute.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 @@ -83,7 +93,8 @@ type Config struct { 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 + // 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 @@ -97,10 +108,12 @@ type Config struct { // 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, 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 + // 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"` @@ -109,7 +122,16 @@ type Config struct { // 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: + // 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 diff --git a/website/source/docs/builders/googlecompute.html.md b/website/source/docs/builders/googlecompute.html.md.erb similarity index 57% rename from website/source/docs/builders/googlecompute.html.md rename to website/source/docs/builders/googlecompute.html.md.erb index 1c47ae705..31ff90332 100644 --- a/website/source/docs/builders/googlecompute.html.md +++ b/website/source/docs/builders/googlecompute.html.md.erb @@ -207,156 +207,11 @@ builder. ### Required: -- `project_id` (string) - The project ID that will be used to launch - instances and store images. - -- `source_image` (string) - 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"` - -- `source_image_family` (string) - 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"`. - -- `zone` (string) - The zone in which to launch the instance used to create - the image. Example: `"us-central1-a"` +<%= partial "partials/builder/googlecompute/Config-required" %> ### Optional: -- `account_file` (string) - 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. - -- `accelerator_count` (number) - Number of guest accelerator cards to add to - the launched instance. - -- `accelerator_type` (string) - 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"` - -- `address` (string) - The name of a pre-allocated static external IP - address. Note, must be the name and not the actual IP address. - -- `disable_default_service_account` (bool) - 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. - -- `disk_name` (string) - The name of the disk, if unset the instance name - will be used. - -- `disk_size` (number) - The size of the disk in GB. This defaults to `10`, - which is 10GB. - -- `disk_type` (string) - Type of disk used to back your instance, like - `pd-ssd` or `pd-standard`. Defaults to `pd-standard`. - -- `image_description` (string) - The description of the resulting image. - -- `image_family` (string) - 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. - -- `image_labels` (object of key/value strings) - Key/value pair labels to - apply to the created image. - -- `image_licenses` (array of strings) - Licenses to apply to the created - image. - -- `image_name` (string) - The unique name of the resulting image. Defaults to - `"packer-{{timestamp}}"`. - -- `image_encryption_key` (object of encryption key) - 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. - - example: - ``` json - { - "kmsKeyName": "projects/${project}/locations/${region}/keyRings/computeEngine/cryptoKeys/computeEngine/cryptoKeyVersions/4" - } - ``` - -- `instance_name` (string) - A name to give the launched instance. Beware - that this must be unique. Defaults to `"packer-{{uuid}}"`. - -- `labels` (object of key/value strings) - Key/value pair labels to apply to - the launched instance. - -- `machine_type` (string) - The machine type. Defaults to `"n1-standard-1"`. - -- `metadata` (object of key/value strings) - Metadata applied to the launched - instance. - -- `min_cpu_platform` (string) - 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) - -- `network` (string) - 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_project_id` (string) - The project ID for the network and - subnetwork to use for launched instance. Defaults to `project_id`. - -- `omit_external_ip` (boolean) - If true, the instance will not have an - external IP. `use_internal_ip` must be true if this property is true. - -- `on_host_maintenance` (string) - 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` - -- `preemptible` (boolean) - If true, launch a preemptible instance. - -- `region` (string) - The region in which to launch the instance. Defaults to - the region hosting the specified `zone`. - -- `service_account_email` (string) - The service account to be used for - launched instance. Defaults to the project's default service account unless - `disable_default_service_account` is true. - -- `scopes` (array of strings) - 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" - ] - ``` - -- `source_image_project_id` (string) - The project ID of the project - containing the source image. - -- `startup_script_file` (string) - The path to a startup script to run on the - VM from which the image will be made. - -- `state_timeout` (string) - The time to wait for instance state changes. - Defaults to `"5m"`. - -- `subnetwork` (string) - 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))` - -- `tags` (array of strings) - Assign network tags to apply firewall rules to - VM instance. - -- `use_internal_ip` (boolean) - If true, use the instance's internal IP - instead of its external IP during building. +<%= partial "partials/builder/googlecompute/Config-not-required" %> ## Startup Scripts diff --git a/website/source/partials/builder/googlecompute/_Config-not-required.html.md b/website/source/partials/builder/googlecompute/_Config-not-required.html.md index b1d5ccfe8..13aecab71 100644 --- a/website/source/partials/builder/googlecompute/_Config-not-required.html.md +++ b/website/source/partials/builder/googlecompute/_Config-not-required.html.md @@ -1,34 +1,29 @@ -- `account_file` (string) - 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. +- `account_file` (string) - 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. -- `accelerator_type` (string) - 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" +- `accelerator_type` (string) - 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"` -- `accelerator_count` (int64) - Number of guest accelerator cards to add to - the launched instance. +- `accelerator_count` (int64) - Number of guest accelerator cards to add to the launched instance. -- `address` (string) - The name of a pre-allocated static external IP - address. Note, must be the name and not the actual IP address. +- `address` (string) - The name of a pre-allocated static external IP address. Note, must be + the name and not the actual IP address. -- `disable_default_service_account` (bool) - 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. +- `disable_default_service_account` (bool) - 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. -- `disk_name` (string) - The name of the disk, if unset the instance name - will be used. +- `disk_name` (string) - The name of the disk, if unset the instance name will be used. -- `disk_size` (int64) - The size of the disk in GB. This defaults to 10, - which is 10GB. +- `disk_size` (int64) - The size of the disk in GB. This defaults to 10, which is 10GB. -- `disk_type` (string) - Type of disk used to back your instance, like - pd-ssd or pd-standard. Defaults to pd-standard. +- `disk_type` (string) - Type of disk used to back your instance, like pd-ssd or pd-standard. + Defaults to pd-standard. - `image_name` (string) - The unique name of the resulting image. Defaults to "packer-{{timestamp}}". @@ -36,84 +31,97 @@ - `image_description` (string) - The description of the resulting image. - `image_encryption_key` (*compute.CustomerEncryptionKey) - 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. -- `image_family` (string) - 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. + example: -- `image_labels` (map[string]string) - Key/value pair labels to - apply to the created image. + ``` json + { + "kmsKeyName": "projects/${project}/locations/${region}/keyRings/computeEngine/cryptoKeys/computeEngine/cryptoKeyVersions/4" + } + ``` -- `image_licenses` ([]string) - Licenses to apply to the created - image. +- `image_family` (string) - 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. -- `instance_name` (string) - A name to give the launched instance. Beware - that this must be unique. Defaults to "packer-{{uuid}}". +- `image_labels` (map[string]string) - Key/value pair labels to apply to the created image. -- `labels` (map[string]string) - Key/value pair labels to apply to - the launched instance. +- `image_licenses` ([]string) - Licenses to apply to the created image. + +- `instance_name` (string) - A name to give the launched instance. Beware that this must be unique. + Defaults to "packer-{{uuid}}". + +- `labels` (map[string]string) - Key/value pair labels to apply to the launched instance. - `machine_type` (string) - The machine type. Defaults to "n1-standard-1". -- `metadata` (map[string]string) - Metadata applied to the launched - instance. +- `metadata` (map[string]string) - Metadata applied to the launched instance. -- `min_cpu_platform` (string) - 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 +- `metadata_files` (map[string]string) - Metadata applied to the launched instance. Values are files. -- `network` (string) - 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 +- `min_cpu_platform` (string) - 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) + +- `network` (string) - 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_project_id` (string) - The project ID for the network and - subnetwork to use for launched instance. Defaults to project_id. +- `network_project_id` (string) - The project ID for the network and subnetwork to use for launched + instance. Defaults to project_id. -- `omit_external_ip` (bool) - If true, the instance will not have an - external IP. use_internal_ip must be true if this property is true. +- `omit_external_ip` (bool) - If true, the instance will not have an external IP. use_internal_ip must + be true if this property is true. -- `on_host_maintenance` (string) - Sets Host Maintenance Option. Valid - choices are MIGRATE and TERMINATE. Please see GCE 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 +- `on_host_maintenance` (string) - 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` - `preemptible` (bool) - If true, launch a preemptible instance. -- `state_timeout` (string) - The time to wait for instance state changes. - Defaults to "5m". +- `state_timeout` (string) - The time to wait for instance state changes. Defaults to "5m". -- `region` (string) - The region in which to launch the instance. Defaults to - the region hosting the specified zone. +- `region` (string) - The region in which to launch the instance. Defaults to the region + hosting the specified zone. - `scopes` ([]string) - The service account scopes for launched instance. Defaults to: -- `service_account_email` (string) - The service account to be used for - launched instance. Defaults to the project's default service account unless - disable_default_service_account is true. + ``` json + [ + "https://www.googleapis.com/auth/userinfo.email", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/devstorage.full_control" + ] + ``` -- `source_image_project_id` (string) - The project ID of the project - containing the source image. +- `service_account_email` (string) - The service account to be used for launched instance. Defaults to the + project's default service account unless disable_default_service_account + is true. -- `startup_script_file` (string) - The path to a startup script to run on the - VM from which the image will be made. +- `source_image_project_id` (string) - The project ID of the project containing the source image. -- `subnetwork` (string) - 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 +- `startup_script_file` (string) - The path to a startup script to run on the VM from which the image will + be made. + +- `subnetwork` (string) - 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)) -- `tags` ([]string) - Assign network tags to apply firewall rules to - VM instance. +- `tags` ([]string) - Assign network tags to apply firewall rules to VM instance. -- `use_internal_ip` (bool) - If true, use the instance's internal IP - instead of its external IP during building. +- `use_internal_ip` (bool) - If true, use the instance's internal IP instead of its external IP + during building. \ No newline at end of file diff --git a/website/source/partials/builder/googlecompute/_Config-required.html.md b/website/source/partials/builder/googlecompute/_Config-required.html.md index c2a1213a4..3f364dd3b 100644 --- a/website/source/partials/builder/googlecompute/_Config-required.html.md +++ b/website/source/partials/builder/googlecompute/_Config-required.html.md @@ -1,17 +1,16 @@ -- `project_id` (string) - The project ID that will be used to launch - instances and store images. +- `project_id` (string) - The project ID that will be used to launch instances and store images. -- `source_image` (string) - 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" +- `source_image` (string) - 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" -- `source_image_family` (string) - 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". +- `source_image_family` (string) - 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". -- `zone` (string) - The zone in which to launch the instance used to create - the image. Example: "us-central1-a" +- `zone` (string) - The zone in which to launch the instance used to create the image. + Example: "us-central1-a" \ No newline at end of file