Commit Graph

66 Commits

Author SHA1 Message Date
Adrien Delorme b038cd10f5 GCP: Allow to set MinCpuPlatform 2018-08-21 10:09:30 +02:00
deepuashokan85 10f118b14c
Update driver_gce.go
Added "rhel-sap-cloud" Projects_ID.
2018-05-31 11:29:57 +05:30
Megan Marsh ed6d999b1f add windows-sql-cloud to the list of projects to check for an image name 2018-04-27 11:24:08 -07:00
Seth Vargo b17b333e29
Add a common package for specifying useragent and adopt that everywhere
There were 5 different formats for the Packer useragent string. This
fixes that and unifies it into a helper package.

I did not touch oracle's user-agent, because it looked kinda special.
2018-04-05 14:28:50 -04:00
Evan Brown 4a2c124ea2 builder/googlecompute: Optionally disable service account
The ability to use a service account other than the default was
introduced in #5928. This change adds to that by introducing the
'disable_default_service_account' config option. If true - and
'service_account_email' is not set - Packer will create a GCE VM
with no service account.
2018-03-07 20:53:26 -08:00
Christophe Courtaut 4befdce47e builder/googlecompute: Adds ability to specify service account
This commit allows user to specify the service account they want
to associate with the virtual machine provisionned by setting
the service_account_email field in the config.

It allows to manage permissions of the instantiated VM properly,
using a service account that can be tied up to IAM roles and
permissions.
2018-02-22 17:19:13 +01:00
Petr Hosek eaef2961cb Support specifying licenses for Google Compute images
This is needed to enable features such as the nested virtualization:
https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances
2018-02-03 14:15:16 -06:00
Daniel Hess f0299ba713 Adding GCE container optimized os image project 2017-11-12 00:45:22 -08:00
Evan Brown 13e0c232d4 builder/googlecompute: Test networking interpolation
This change pulls the logic that interpolates network and subnetwork
into its own func and adds tests.
2017-11-06 21:22:53 -08:00
Evan Brown f2fed94a71 builder/googlecompute: Derive network and subnetwork IDs locally
This change constructs partial URLs for networks and subnetworks if they
are not already partial or full URLs (i.e., they do not contain a '/' in
their name). Network and subnetwork self-links are no longer retrieved
from the API.

Previously, if a user did not provide the network or subnetwork as a
fully-qualified URL (i.e., self-link), the builder would make
compute.(sub)networks.get API calls with the provided identifier to
discover the self-link. This requires the user or service account Packer
is using to have permission to describe those network resources, which
is becoming less common as IAM is used more. Specifically, a user may
have permission to launch a VM into a network/subnetwork, but will not
have permission to call APIs to describe network resources.
2017-11-06 16:41:42 -08:00
Peter Mounce 5bcb0644c3 Using CI for compilation errors because am on Windows 2017-09-18 18:13:21 +01:00
Peter Mounce ac8eedf171 Introduce a new configuration parameter instead
... so that one can have a different list compared to instances.
2017-09-18 17:53:40 +01:00
Peter Mounce 8789ae72e8 Make the googlecompute builder label the resulting image.
... so that it's possible to find images matching particular characteristics more easily.
2017-09-18 15:44:01 +01:00
Patrick Decat a7283f2281 Add support for setting labels on GCE instance 2017-09-06 10:58:08 +02:00
Saulius Grusnys 5ebc96744d Accelerator api is now GA, switching back to v1 from v0.beta 2017-07-21 15:05:24 +01:00
Saulius Grusnys 200113b8c1 Switch googlecompute builder to use compute/v0.beta and add support for accelerator api 2017-07-17 15:39:41 +01:00
Rickard von Essen f230f00726 googlecompute: Allow using URL's for network and subnetwork
If full server URL's is used in subnetwork we can skip reading from the network
API. This is usefull when you can launch instances in a shared network but don't
have access to do GET on the network resources.

Closes: #5018
2017-06-27 21:58:21 +02:00
Matthew Hooker 94d7a4ce8d
post-processor/vagrant-cloud: try upload once
* fixes multiple uploads mentioned in #4973
* removed unused token code
2017-06-12 17:34:32 -07:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Rickard von Essen 77dc8b84c1
builder/googlecompute: Revert to using default service account
Fixes issue with cross Project builds.

Closes #4608

Regression introduced in PR #3639
2017-04-02 17:52:14 +02:00
Dimitri Rudnev bab590c177 Adding OnHostMaintenance option for googlecompue builder 2017-02-10 10:58:57 -08:00
Troy Toman 12f279fa79 add ability to set a different project-id for a network in the googlecloud builder 2016-12-02 15:22:36 -06:00
Peter Schultz bcb319640e builder/googlecompute: support source image family
Closes #4100
2016-11-13 16:54:04 +01:00
Matthew Hooker d920b3fbf4 run gofmt 2016-11-01 14:08:04 -07:00
YAMADA Tsuyoshi da7d317e46 googlecompute: Run instance with custom scopes 2016-10-22 15:46:14 +09:00
Rickard von Essen 924c0bc461 Merge pull request #3932 from pieter-lazzaro/googlecompute-createpassword
GCE Windows instance password creation
2016-09-30 22:01:56 +02:00
Matthew Hooker a9abe43325 builder/amazon: add retry login when creating tags.
also move Retry from builder/googlecompute/common to common/retry
2016-09-28 18:22:31 -07:00
Pieter Lazzaro 5db1c1f503 Create a password for windows instances when using WinRM communicator and no password is provided. 2016-09-27 18:42:34 -04:00
Yuki Takeichi 04078c5c48 Enable to select NVMe images for googlecompute builder 2016-09-20 12:47:14 +02:00
Scott Crunkleton b54b82d3ac Some googlecompute fixes and cleanup. Addresses https://github.com/mitchellh/packer/issues/3829. Changes:
- startup scripts don't run for Windows since it is isn't implemented yet.
- startup scripts use instance metadata instead of serial port output to flag when they are done.
- added licenses to Image data type (to check if an Image is a  Windows Image).
- added GetImage and GetImageFromProject to googlecompute Drivers.
- changed some of the builder/googlecompute tests to use github.com/stretchr/testify/assert.

Tests:
- (in the Packer directory) `go test .`, `go test ./builder/googlecompute`, and `go test ./post-processor/googlecompute-export`
- manual run of `packer build packer_template.json` with the following files

--packer_template.json--
{
  "builders": [
    {
      "type": "googlecompute",
      "account_file": "creds.json",
      "project_id": "google.com:packer-test",
      "source_image": "debian-8-jessie-v20160629",
      "zone": "us-central1-a",
      "startup_script_file": "startup_script.sh",
      "metadata": {
        "startup-script": "#!/bin/sh\necho \"This should be overwritten.\"",
        "startup-script-log-dest": "gs://packer-test.google.com.a.appspot.com/startup-script.log"
      },
      "image_name": "test-packer-modifications",
      "ssh_username": "foo"
    }
  ],
  "post-processors": [
    {
      "type": "googlecompute-export",
      "paths": [
        "gs://packer-test.google.com.a.appspot.com/foo.tar.gz",
        "gs://packer-test.google.com.a.appspot.com/bar.tar.gz"
      ],
      "keep_input_artifact": true
    }
  ]
}

--startup_script.sh--
\#!/bin/sh
echo "Hi, my name is Scott. I'm waiting 60 seconds!" >> /scott
sleep 60
echo "I'm done waiting!" >> /scott
2016-09-09 16:22:50 -07:00
Ingo Gottwald 0c1051a017 GCE builder: Switch to google.DefaultClient (#3655)
* GCE builder: Switch to google.DefaultClient

This enables authentication through an authenticated gcloud tool.

* GCE builder: Add docs about auth mech precedence
2016-08-27 03:12:55 +02:00
crunk1 55b5a45ae4 Created googlecompute-export post-processor. Modified the googlecompute builder to pass a few configuration values to its resulting artifact. These values can then be used in googlecompute-export post-processor.
Added documentation and changed authentication stuff on temporary VM.
2016-08-15 14:36:26 -07:00
Evan Brown a5c598264f builder/googlecompute: Support provisioning VM without external IP address
This change adds an `omit_external_ip` configuration property that, when true,
will cause no external IP address to be associated with the Google Compute
Engine VM provisioned to create an image. When using `omit_external_ip`, you
must also set the `use_internal_ip` configuration property to true.

Addresses #3296
2016-08-02 13:43:04 -07:00
Scott Crunkleton 7190fbeed8 Adding support for googlecompute startup scripts.
- Startup scripts can be provided through the instance creation metadata field 'startup-script'.
- Script log can be copied to a GCS location by setting the metadata field 'startup-script-log-dest'.
Added Retry method to googlecompute package.
Added GetSerialPortOutput to googlecompute Drivers.
Added StepWaitInstanceStartup (and associated test) which waits for an
instance startup-script to finish.
Changed the instance service account to use the same service account as the one provided in the Packer config template. It was the project default service account.

Tested googlecompute package with 'go test' and also performed builds
with a startup script and without a startup script.
2016-07-20 14:54:36 -07:00
Peter Schultz 8546aafec5 builder/googlecompute: support image family 2016-05-13 15:24:02 -07:00
Christopher Boumenot 2d1347c1ec Insert Packer's version into the User Agent. (#3465) 2016-05-05 13:10:55 -07:00
Chris Bednarski 1b1bbb604e Merge branch 'googlecompute-disk-type' of https://github.com/meatballhat/packer into f-google-disk-type 2016-03-10 14:51:30 -08:00
Chris Bednarski 4458de4ea0 Reformat 2016-02-11 23:53:40 -08:00
Matt Morrison 942aaa7a85 Add support for Google subnetworks. Closes #3062. Fixes an issue with how packer populates instances metadata. Closes #3181 2016-02-11 17:31:46 +13:00
Caius Howcroft 069c3c21b1 Added support for GCE external static IPs 2015-12-24 19:15:41 -06:00
YAMADA Tsuyoshi afd314959b supported `preemptible` in googlecompute builder 2015-12-05 05:13:35 +09:00
Dan Buch cac93d311c builder/googlecompute: accept disk type, default pd-standard 2015-10-13 20:18:26 -04:00
Rickard von Essen 9cf99289c5 Fixed GCE builder after dependency change.
See
4af91da601
2015-09-20 10:14:07 +02:00
Andrew Bayer ebdd0d991a Adds support for using the internal IP rather than NAT IP in GCE 2015-05-29 14:50:11 -07:00
Dave Cunningham 982934dfb9 Use new Google API and OAuth libs, add UserAgent string 2015-04-17 15:12:39 -04:00
Ross Smith II 10dee1bd68 Temporarily fix build by forking golang.org/x/oauth2 @ b3f9a68 2014-12-21 11:22:24 -08:00
Dustin Carlino 7c67228912 Check if image already exists before doing anything else on GCE.
This fixes #1729.
2014-12-09 08:42:34 -08:00
rhapsodhy dd547af0c4 fix googlecompute oauth dependency 2014-11-30 04:15:44 +00:00
Dustin Carlino 23c947acf0 Create GCE image from persistent disk instead of from a tarball.
The new flow:
1) Provision the instance
2) Tear down the instance, but keep the boot disk
3) Create an image from the disk
4) Tear down the disk

The step to update gcloud is no longer needed, since gceimagebundle isn't used anymore.
Fixes #1507 and addresses https://github.com/mitchellh/packer/issues/1447#issuecomment-61610235.
2014-11-25 17:07:06 -08:00
Eric Johnson 87001dba60 Merge pull request #1679 from evandbrown/gce-service-accounts
Use golang/oauth2, no longer require client_secrets.json, and use
2014-11-24 05:43:11 -08:00