vagrant-google 2.3.0.rc0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: '08471e3d05bc8414569638e5fdc304ee522d743f'
4
- data.tar.gz: a91555ed68b59ce5e1b84d1bab7b681ebb1ce890
2
+ SHA256:
3
+ metadata.gz: 22135d118cd7749f09bab503e584dce947d56ce3dbe1fe7d43624be1d8edd9bf
4
+ data.tar.gz: 4d4e3e45565c5a3ce26494ba5942000d404791a46045a990b866ebd401cb4d1a
5
5
  SHA512:
6
- metadata.gz: 91a2d9310f63eb4eb3755d5a7d7d68c19bfc1975b5ba77521bbebcfc87089f07bf7f790e5f474c390bae626324fa7b7fde3c1e85eef8432f5e31f6efae6f6331
7
- data.tar.gz: 1f666a0801fc61431bbe3c970483a5b09672de88441d5671631ef4f988a67db9bfbe145900d636bd2488a5bfee4df73e0844b9f4cc2c31cc3abfb0023210e4f1
6
+ metadata.gz: ed1cb603bd11da1e6d402490e3a92cc683e2c1060a7982c2809b39fa86200ec62a5921791df6c954e45482918b84531d4df8437c3da368b99df717ac2dfac03f
7
+ data.tar.gz: fbe0d8f7cb29a6d386cb7d501c3057acf426f390c93146c6acfe23274cc83a422c44a09bf1119c8295f0b92547e79d2e9477cca3e0a9aab1ba3543aa093bbb15
data/.gitignore CHANGED
@@ -17,3 +17,6 @@ vendor/*
17
17
 
18
18
  # Intellij projects folder
19
19
  .idea
20
+
21
+ # Env
22
+ setenv_*.sh
@@ -1,5 +1,4 @@
1
- # Importing TODO list to sanely lint new submissions.
2
- inherit_from: .rubocop_todo.yml
1
+ require: rubocop-performance
3
2
 
4
3
  # Custom project config
5
4
  AllCops:
@@ -7,11 +6,20 @@ AllCops:
7
6
  - './Vagrantfile'
8
7
  - './vagrant-google.gemspec'
9
8
 
10
- Style/EmptyLinesAroundBlockBody:
9
+ Layout/EmptyLinesAroundBlockBody:
11
10
  Enabled: false
12
11
 
13
12
  Style/StringLiterals:
14
13
  Enabled: false
15
14
 
16
15
  Style/IfUnlessModifier:
17
- Enabled: false
16
+ Enabled: false
17
+
18
+ Metrics/LineLength:
19
+ Max: 120
20
+
21
+ Layout/HashAlignment:
22
+ EnforcedHashRocketStyle: table
23
+
24
+ Style/HashSyntax:
25
+ EnforcedStyle: no_mixed_keys
@@ -1,2 +1,2 @@
1
- 2.4.3
2
- # Tracking Vagrant 2.0.3
1
+ 2.6.6
2
+ # Tracking Vagrant 2.2.9
@@ -2,6 +2,73 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## Next
6
+
7
+
8
+ ### User-facing
9
+
10
+ #### Added
11
+
12
+ - \#248 Add support for modifying the configuration of Shielded VM [lcy0321]
13
+ - \#244 Add accelerator (GPU) configuration [johanvdhaegen]
14
+ - \#216 Add support for Windows hosts through WinRM [dvanbrug]
15
+
16
+ #### Fixed
17
+
18
+ - \#246 Fix config override during metadata merge [mavin]
19
+ - \#249 Fix shielded API failures on non-shielded VM's [temikus]
20
+ - \#227 Fix additional disks being auto-deleted unless a disk type is specified [chrisgavin]
21
+
22
+ ### Development
23
+
24
+ #### Fixed
25
+
26
+ - \#247 chore: Update Gemfile with new `vagrant-spec` branch name [mavin]
27
+ - \#241 Fix unfortunate CI `on:` trigger typo [temikus]
28
+ - \#240 Update development environment, add CI functionality [Temikus]
29
+ - \#239 Remove old fixup in Gemfile [Temikus]
30
+ - \#237 Bump image size for test skeleton [Temikus]
31
+
32
+
33
+ ## 2.5.0 (September 2019)
34
+
35
+ ### User-facing
36
+
37
+ #### Added
38
+ - \#222 Added internal IP support [andrewh1978]
39
+
40
+ #### Deprecated
41
+
42
+ - \#220 Deprecated google_client_email parameter, as it's no longer needed or
43
+ supported by fog-google [temikus]
44
+
45
+ ### Development
46
+
47
+ #### Added
48
+
49
+ - \#223 Set up unit test GitHub Action worflow [temikus]
50
+
51
+ #### Fixed
52
+
53
+ - \#225 Locked the vagrant dep to 2.2.4 due to bundler issues on 2.2.5 [temikus]
54
+
55
+ ## 2.4.0 (April 2019)
56
+
57
+ ### User-facing
58
+
59
+ #### Added
60
+ - \#213 Implemented Application Default Credentials authentication [mavin]
61
+
62
+ #### Fixed
63
+ - \#214 Set a default zone only if `default` network is used [mavin]
64
+ - \#215 Allow tags,labels and additional_disks to be merged with multiple
65
+ configs [mavin]
66
+
67
+ ### Development
68
+
69
+ - \#213 Bumped dependencies [mavin]
70
+ - fog-google version to 1.9.0
71
+
5
72
  ## 2.3.0 (February 2019)
6
73
 
7
74
  ### User-facing
@@ -16,14 +83,14 @@ The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1
16
83
 
17
84
  ### User-facing
18
85
 
19
- - \#206 Fix image selection logic - Plugin no longer traces back with
86
+ - \#206 Fix image selection logic - Plugin no longer traces back with
20
87
  `image_family` config option. [temikus]
21
88
 
22
89
  ### Development
23
90
 
24
91
  - \#206 Bumped dependencies. [temikus]
25
- - fog-google version to 1.8.1
26
- - vagrant & vagrant-spec are now pointing to new upstream Hashicorp org repos
92
+ - fog-google version to 1.8.1
93
+ - vagrant & vagrant-spec are now pointing to new upstream Hashicorp org repos
27
94
 
28
95
  ## 2.2.0 (June 2018)
29
96
 
@@ -42,13 +109,13 @@ platforms.
42
109
  ## 2.0.0 (March 2018)
43
110
 
44
111
  * Update to use fog-google gem v1
45
- * Add new configuration option `labels` for setting [labels](https://cloud.google.com/compute/docs/labeling-resources)
112
+ * Add new configuration option `labels` for setting [labels](https://cloud.google.com/compute/docs/labeling-resources)
46
113
  on GCE instances
47
114
  * Fix disk cleanup issue causing the disk to be marked as created before insertion
48
115
  * Test environment fixups to avoid 'Encoded files can't be read outside of the Vagrant installer.'
49
116
  * Breaking changes:
50
117
  * Drop support for configuration option `google_key_location`(GCP P12 key)
51
- * `image` parameter no longer defaults to an arbitrary image and must be
118
+ * `image` parameter no longer defaults to an arbitrary image and must be
52
119
  specified at runtime
53
120
  * Rsync behavior now consistent with Vagrant's default, removed old rsync code
54
121
 
data/Gemfile CHANGED
@@ -23,6 +23,7 @@ group :development do
23
23
  # We depend on Vagrant for development, but we don't add it as a
24
24
  # gem dependency because we expect to be installed within the
25
25
  # Vagrant environment itself using `vagrant plugin`.
26
+
26
27
  gem 'vagrant', git: "https://github.com/hashicorp/vagrant.git"
27
- gem 'vagrant-spec', git: "https://github.com/hashicorp/vagrant-spec.git"
28
+ gem 'vagrant-spec', git: "https://github.com/hashicorp/vagrant-spec.git", branch: "main"
28
29
  end
data/README.md CHANGED
@@ -16,7 +16,7 @@ The maintainers for this plugin are @temikus(primary), @erjohnso(backup).
16
16
  * Boot Google Compute Engine instances.
17
17
  * SSH into the instances.
18
18
  * Provision the instances with any built-in Vagrant provisioner.
19
- * Synced folder support via Vagrant's
19
+ * Synced folder support via Vagrant's
20
20
  [rsync action](https://www.vagrantup.com/docs/synced-folders/rsync.html).
21
21
  * Define zone-specific configurations so Vagrant can manage machines in
22
22
  multiple zones.
@@ -73,8 +73,8 @@ Service Account for API Access.
73
73
  ## Quick Start
74
74
 
75
75
  After installing the plugin (instructions above), the quickest way to get
76
- started is to actually use a dummy Google box from Atlas and specify all the
77
- details manually within a `config.vm.provider` block.
76
+ started is to actually use a dummy Google box from Atlas and specify all the
77
+ details manually within a `config.vm.provider` block.
78
78
 
79
79
  So first, make a Vagrantfile that looks like the following, filling in
80
80
  your information where necessary:
@@ -85,11 +85,10 @@ Vagrant.configure("2") do |config|
85
85
 
86
86
  config.vm.provider :google do |google, override|
87
87
  google.google_project_id = "YOUR_GOOGLE_CLOUD_PROJECT_ID"
88
- google.google_client_email = "YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS"
89
88
  google.google_json_key_location = "/path/to/your/private-key.json"
90
-
89
+
91
90
  google.image_family = 'ubuntu-1604-lts'
92
-
91
+
93
92
  override.ssh.username = "USERNAME"
94
93
  override.ssh.private_key_path = "~/.ssh/id_rsa"
95
94
  #override.ssh.private_key_path = "~/.ssh/google_compute_engine"
@@ -100,10 +99,10 @@ end
100
99
 
101
100
  And then run `vagrant up --provider=google`.
102
101
 
103
- This will start a latest version of Ubuntu 16.04 LTS instance in the
104
- `us-central1-f` zone, with an `n1-standard-1` machine, and the `"default"`
105
- network within your project. And assuming your SSH information (see below) was
106
- filled in properly within your Vagrantfile, SSH and provisioning will work as
102
+ This will start a latest version of Ubuntu 16.04 LTS instance in the
103
+ `us-central1-f` zone, with an `n1-standard-1` machine, and the `"default"`
104
+ network within your project. And assuming your SSH information (see below) was
105
+ filled in properly within your Vagrantfile, SSH and provisioning will work as
107
106
  well.
108
107
 
109
108
  Note that normally a lot of this boilerplate is encoded within the box file,
@@ -165,16 +164,14 @@ configuration for this provider.
165
164
 
166
165
  This provider exposes quite a few provider-specific configuration options:
167
166
 
168
- * `google_client_email` - The Client Email address for your Service Account.
169
- (Can also be configured with `GOOGLE_CLIENT_EMAIL` environment variable.)
170
167
  * `google_json_key_location` - The location of the JSON private key file matching your
171
- Service Account.
168
+ Service Account.
172
169
  (Can also be configured with `GOOGLE_JSON_KEY_LOCATION` environment variable.)
173
- * `google_project_id` - The Project ID for your Google Cloud Platform account.
170
+ * `google_project_id` - The Project ID for your Google Cloud Platform account.
174
171
  (Can also be configured with `GOOGLE_PROJECT_ID` environment variable.)
175
172
  * `image` - The image name to use when booting your instance.
176
- * `image_family` - Specify an "image family" to pull the latest image from. For example: `centos-7`
177
- will pull the most recent CentOS 7 image. For more info, refer to
173
+ * `image_family` - Specify an "image family" to pull the latest image from. For example: `centos-7`
174
+ will pull the most recent CentOS 7 image. For more info, refer to
178
175
  [Google Image documentation](https://cloud.google.com/compute/docs/images#image_families).
179
176
  * `image_project_id` - The ID of the GCP project to search for the `image` or `image_family`.
180
177
  * `instance_group` - Unmanaged instance group to add the machine to. If one
@@ -198,6 +195,7 @@ will pull the most recent CentOS 7 image. For more info, refer to
198
195
  * `zone` - The zone name where the instance will be created.
199
196
  * `can_ip_forward` - Boolean whether to enable IP Forwarding.
200
197
  * `external_ip` - The external IP address to use (supports names). Set to `false` to not assign an external address.
198
+ * `network_ip` - The internal IP address to use. Default is to use next available address.
201
199
  * `use_private_ip` - Boolean whether to use private IP for SSH/provisioning. Default is false.
202
200
  * `preemptible` - Boolean whether to enable preemptibility. Default is false.
203
201
  * `auto_restart` - Boolean whether to enable auto_restart. Default is true.
@@ -208,20 +206,36 @@ will pull the most recent CentOS 7 image. For more info, refer to
208
206
  utility aliases, for example:
209
207
  `['storage-full', 'bigquery', 'https://www.googleapis.com/auth/compute']`.
210
208
  * `service_account` - The IAM service account email to use for the instance.
211
- * `additional_disks` - An array of additional disk configurations. `disk_size` is default to `10`GB;
212
- `disk_name` is default to `name` + "-additional-disk-#{index}"; `disk_type` is default to `pd-standard`;
209
+ * `additional_disks` - An array of additional disk configurations. `disk_size` is default to `10`GB;
210
+ `disk_name` is default to `name` + "-additional-disk-#{index}"; `disk_type` is default to `pd-standard`;
213
211
  `autodelete_disk` is default to `true`. Here is an example of configuration.
214
- ```ruby
215
- [{
216
- :image_family => "google-image-family",
217
- :image => nil,
218
- :image_project_id => "google-project-id",
219
- :disk_size => 20,
220
- :disk_name => "google-additional-disk-0",
221
- :disk_type => "pd-standard",
222
- :autodelete_disk => true
212
+ ```ruby
213
+ [{
214
+ :image_family => "google-image-family",
215
+ :image => nil,
216
+ :image_project_id => "google-project-id",
217
+ :disk_size => 20,
218
+ :disk_name => "google-additional-disk-0",
219
+ :disk_type => "pd-standard",
220
+ :autodelete_disk => true
221
+ }]
222
+ ```
223
+ * `accelerators` - An array of accelerator configurations. `type` is the
224
+ accelerator type (e.g. `nvidia-tesla-k80`); `count` is the number of
225
+ accelerators and defaults to 1. Note that only `TERMINATE` is supported for
226
+ `on_host_maintenance`; this should be set explicitly, since the default is
227
+ `MIGRATE`.
228
+ ```ruby
229
+ google.accelerators = [{
230
+ :type => "nvidia-tesla-k80",
231
+ :count => 2
223
232
  }]
224
- ```
233
+
234
+ google.on_host_maintenance = "TERMINATE"
235
+ ```
236
+ * `enable_secure_boot` - For [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm), whether to enable Secure Boot.
237
+ * `enable_vtpm` - For [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm), whether to enable vTPM.
238
+ * `enable_integrity_monitoring` - For [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm), whether to enable Integrity monitoring.
225
239
 
226
240
  These can be set like typical provider-specific configuration:
227
241
 
@@ -231,7 +245,6 @@ Vagrant.configure("2") do |config|
231
245
 
232
246
  config.vm.provider :google do |google|
233
247
  google.google_project_id = "YOUR_GOOGLE_CLOUD_PROJECT_ID"
234
- google.google_client_email = "YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS"
235
248
  google.google_json_key_location = "/path/to/your/private-key.json"
236
249
  end
237
250
  end
@@ -249,7 +262,6 @@ Vagrant.configure("2") do |config|
249
262
 
250
263
  config.vm.provider :google do |google|
251
264
  google.google_project_id = "YOUR_GOOGLE_CLOUD_PROJECT_ID"
252
- google.google_client_email = "YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS"
253
265
  google.google_json_key_location = "/path/to/your/private-key.json"
254
266
 
255
267
  # Make sure to set this to trigger the zone_config
@@ -284,7 +296,7 @@ emit a warning, but will otherwise boot the GCE machine.
284
296
  ## Synced Folders
285
297
 
286
298
  Since plugin version 2.0, this is implemented via built-in `SyncedFolders` action.
287
- See Vagrant's [rsync action](https://www.vagrantup.com/docs/synced-folders/rsync.html)
299
+ See Vagrant's [rsync action](https://www.vagrantup.com/docs/synced-folders/rsync.html)
288
300
  documentation for more info.
289
301
 
290
302
  ## Development
@@ -320,7 +332,6 @@ Before you start acceptance tests, you'll need to set the authentication
320
332
  shell variables accordingly:
321
333
 
322
334
  ```sh
323
- export GOOGLE_CLIENT_EMAIL="your-google_service_account_email@developer.gserviceaccount.com"
324
335
  export GOOGLE_PROJECT_ID="your-google-cloud-project-id"
325
336
  export GOOGLE_JSON_KEY_LOCATION="/full/path/to/your/private-key.json"
326
337
 
@@ -82,6 +82,15 @@ module VagrantPlugins
82
82
  end
83
83
  end
84
84
 
85
+ # This action is called to setup the Windows user/password on the machine.
86
+ def self.action_setup_winrm_password
87
+ Vagrant::Action::Builder.new.tap do |b|
88
+ b.use ConfigValidate
89
+ b.use ConnectGoogle
90
+ b.use SetupWinrmPassword
91
+ end
92
+ end
93
+
85
94
  # This action is called to read the state of the machine. The
86
95
  # resulting state is expected to be put into the `:machine_state_id`
87
96
  # key.
@@ -182,6 +191,7 @@ module VagrantPlugins
182
191
  autoload :MessageNotCreated, action_root.join("message_not_created")
183
192
  autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
184
193
  autoload :ReadSSHInfo, action_root.join("read_ssh_info")
194
+ autoload :SetupWinrmPassword, action_root.join('setup_winrm_password')
185
195
  autoload :ReadState, action_root.join("read_state")
186
196
  autoload :RunInstance, action_root.join("run_instance")
187
197
  autoload :StartInstance, action_root.join("start_instance")
@@ -26,6 +26,7 @@ module VagrantPlugins
26
26
  @logger = Log4r::Logger.new("vagrant_google::action::connect_google")
27
27
  end
28
28
 
29
+ # Initialize Fog::Compute and add it to the environment
29
30
  def call(env)
30
31
  provider_config = env[:machine].provider_config
31
32
 
@@ -33,16 +34,15 @@ module VagrantPlugins
33
34
  fog_config = {
34
35
  :provider => :google,
35
36
  :google_project => provider_config.google_project_id,
36
- :google_client_email => provider_config.google_client_email
37
37
  }
38
38
 
39
- fog_config[:google_json_key_location] = find_key(provider_config.google_json_key_location, env)
39
+ unless provider_config.google_json_key_location.nil?
40
+ fog_config[:google_json_key_location] = find_key(provider_config.google_json_key_location, env)
41
+ end
40
42
 
41
- @logger.info("Connecting to Google...")
43
+ @logger.info("Creating Google API client and adding to Vagrant environment")
42
44
  env[:google_compute] = Fog::Compute.new(fog_config)
43
-
44
45
  @app.call(env)
45
- @logger.info("...Connected!")
46
46
  end
47
47
 
48
48
  # If the key is not found, try expanding from root location (see #159)
@@ -14,6 +14,7 @@
14
14
  require "log4r"
15
15
  require 'vagrant/util/retryable'
16
16
  require 'vagrant-google/util/timer'
17
+ require 'vagrant-google/action/setup_winrm_password'
17
18
 
18
19
  module VagrantPlugins
19
20
  module Google
@@ -41,63 +42,73 @@ module VagrantPlugins
41
42
  zone = env[:machine].provider_config.zone
42
43
 
43
44
  # Get the configs
44
- zone_config = env[:machine].provider_config.get_zone_config(zone)
45
- image = zone_config.image
46
- image_family = zone_config.image_family
47
- image_project_id = zone_config.image_project_id
48
- instance_group = zone_config.instance_group
49
- name = zone_config.name
50
- machine_type = zone_config.machine_type
51
- disk_size = zone_config.disk_size
52
- disk_name = zone_config.disk_name
53
- disk_type = zone_config.disk_type
54
- network = zone_config.network
55
- network_project_id = zone_config.network_project_id
56
- subnetwork = zone_config.subnetwork
57
- metadata = zone_config.metadata
58
- labels = zone_config.labels
59
- tags = zone_config.tags
60
- can_ip_forward = zone_config.can_ip_forward
61
- use_private_ip = zone_config.use_private_ip
62
- external_ip = zone_config.external_ip
63
- preemptible = zone_config.preemptible
64
- auto_restart = zone_config.auto_restart
65
- on_host_maintenance = zone_config.on_host_maintenance
66
- autodelete_disk = zone_config.autodelete_disk
67
- service_account_scopes = zone_config.scopes
68
- service_account = zone_config.service_account
69
- project_id = zone_config.google_project_id
70
- additional_disks = zone_config.additional_disks
45
+ zone_config = env[:machine].provider_config.get_zone_config(zone)
46
+ image = zone_config.image
47
+ image_family = zone_config.image_family
48
+ image_project_id = zone_config.image_project_id
49
+ instance_group = zone_config.instance_group
50
+ name = zone_config.name
51
+ machine_type = zone_config.machine_type
52
+ disk_size = zone_config.disk_size
53
+ disk_name = zone_config.disk_name
54
+ disk_type = zone_config.disk_type
55
+ network = zone_config.network
56
+ network_project_id = zone_config.network_project_id
57
+ subnetwork = zone_config.subnetwork
58
+ metadata = zone_config.metadata
59
+ labels = zone_config.labels
60
+ tags = zone_config.tags
61
+ can_ip_forward = zone_config.can_ip_forward
62
+ use_private_ip = zone_config.use_private_ip
63
+ external_ip = zone_config.external_ip
64
+ network_ip = zone_config.network_ip
65
+ preemptible = zone_config.preemptible
66
+ auto_restart = zone_config.auto_restart
67
+ on_host_maintenance = zone_config.on_host_maintenance
68
+ autodelete_disk = zone_config.autodelete_disk
69
+ service_account_scopes = zone_config.scopes
70
+ service_account = zone_config.service_account
71
+ project_id = zone_config.google_project_id
72
+ additional_disks = zone_config.additional_disks
73
+ accelerators = zone_config.accelerators
74
+ enable_secure_boot = zone_config.enable_secure_boot
75
+ enable_vtpm = zone_config.enable_vtpm
76
+ enable_integrity_monitoring = zone_config.enable_integrity_monitoring
71
77
 
72
78
  # Launch!
73
79
  env[:ui].info(I18n.t("vagrant_google.launching_instance"))
74
- env[:ui].info(" -- Name: #{name}")
75
- env[:ui].info(" -- Project: #{project_id}")
76
- env[:ui].info(" -- Type: #{machine_type}")
77
- env[:ui].info(" -- Disk type: #{disk_type}")
78
- env[:ui].info(" -- Disk size: #{disk_size} GB")
79
- env[:ui].info(" -- Disk name: #{disk_name}")
80
- env[:ui].info(" -- Image: #{image}")
81
- env[:ui].info(" -- Image family: #{image_family}")
82
- env[:ui].info(" -- Image Project: #{image_project_id}") if image_project_id
83
- env[:ui].info(" -- Instance Group: #{instance_group}")
84
- env[:ui].info(" -- Zone: #{zone}") if zone
85
- env[:ui].info(" -- Network: #{network}") if network
86
- env[:ui].info(" -- Network Project: #{network_project_id}") if network_project_id
87
- env[:ui].info(" -- Subnetwork: #{subnetwork}") if subnetwork
88
- env[:ui].info(" -- Metadata: '#{metadata}'")
89
- env[:ui].info(" -- Labels: '#{labels}'")
90
- env[:ui].info(" -- Network tags: '#{tags}'")
91
- env[:ui].info(" -- IP Forward: #{can_ip_forward}")
92
- env[:ui].info(" -- Use private IP: #{use_private_ip}")
93
- env[:ui].info(" -- External IP: #{external_ip}")
94
- env[:ui].info(" -- Preemptible: #{preemptible}")
95
- env[:ui].info(" -- Auto Restart: #{auto_restart}")
96
- env[:ui].info(" -- On Maintenance: #{on_host_maintenance}")
97
- env[:ui].info(" -- Autodelete Disk: #{autodelete_disk}")
98
- env[:ui].info(" -- Scopes: #{service_account_scopes}") if service_account_scopes
99
- env[:ui].info(" -- Service Account: #{service_account}") if service_account
100
- env[:ui].info(" -- Additional Disks:#{additional_disks}")
80
+ env[:ui].info(" -- Name: #{name}")
81
+ env[:ui].info(" -- Project: #{project_id}")
82
+ env[:ui].info(" -- Type: #{machine_type}")
83
+ env[:ui].info(" -- Disk type: #{disk_type}")
84
+ env[:ui].info(" -- Disk size: #{disk_size} GB")
85
+ env[:ui].info(" -- Disk name: #{disk_name}")
86
+ env[:ui].info(" -- Image: #{image}")
87
+ env[:ui].info(" -- Image family: #{image_family}")
88
+ env[:ui].info(" -- Image Project: #{image_project_id}") if image_project_id
89
+ env[:ui].info(" -- Instance Group: #{instance_group}")
90
+ env[:ui].info(" -- Zone: #{zone}") if zone
91
+ env[:ui].info(" -- Network: #{network}") if network
92
+ env[:ui].info(" -- Network Project: #{network_project_id}") if network_project_id
93
+ env[:ui].info(" -- Subnetwork: #{subnetwork}") if subnetwork
94
+ env[:ui].info(" -- Metadata: '#{metadata}'")
95
+ env[:ui].info(" -- Labels: '#{labels}'")
96
+ env[:ui].info(" -- Network tags: '#{tags}'")
97
+ env[:ui].info(" -- IP Forward: #{can_ip_forward}")
98
+ env[:ui].info(" -- Use private IP: #{use_private_ip}")
99
+ env[:ui].info(" -- External IP: #{external_ip}")
100
+ env[:ui].info(" -- Network IP: #{network_ip}")
101
+ env[:ui].info(" -- Preemptible: #{preemptible}")
102
+ env[:ui].info(" -- Auto Restart: #{auto_restart}")
103
+ env[:ui].info(" -- On Maintenance: #{on_host_maintenance}")
104
+ env[:ui].info(" -- Autodelete Disk: #{autodelete_disk}")
105
+ env[:ui].info(" -- Scopes: #{service_account_scopes}") if service_account_scopes
106
+ env[:ui].info(" -- Service Account: #{service_account}") if service_account
107
+ env[:ui].info(" -- Additional Disks: #{additional_disks}")
108
+ env[:ui].info(" -- Accelerators: #{accelerators}")
109
+ env[:ui].info(" -- Secure Boot: #{enable_secure_boot}") if enable_secure_boot
110
+ env[:ui].info(" -- vTPM: #{enable_vtpm}") if enable_vtpm
111
+ env[:ui].info(" -- Integrity Monitoring: #{enable_integrity_monitoring}") if enable_integrity_monitoring
101
112
 
102
113
  # Munge image config
103
114
  if image_family
@@ -127,6 +138,21 @@ module VagrantPlugins
127
138
  # Munge service_accounts / scopes config
128
139
  service_accounts = [ { :email => service_account, :scopes => service_account_scopes } ]
129
140
 
141
+ # Construct accelerator URLs
142
+ accelerators_url = []
143
+ accelerators.each do |accelerator|
144
+ unless accelerator.key?(:type)
145
+ next
146
+ end
147
+ accelerator_type = "https://compute.googleapis.com/compute/v1/projects/#{project_id}/zones/#{zone}/acceleratorTypes/#{accelerator[:type]}"
148
+ accelerator_count = accelerator.fetch(:count, 1)
149
+ accelerators_url.push({ :accelerator_type => accelerator_type,
150
+ :accelerator_count => accelerator_count })
151
+ end
152
+
153
+ # Munge shieldedInstance config
154
+ shielded_instance_config = { :enable_secure_boot => enable_secure_boot, :enable_vtpm => enable_vtpm, :enable_integrity_monitoring => enable_integrity_monitoring }
155
+
130
156
  begin
131
157
  request_start_time = Time.now.to_i
132
158
  disk = nil
@@ -199,7 +225,7 @@ module VagrantPlugins
199
225
 
200
226
  # Get additional disk auto delete
201
227
  additional_disk_auto_delete = nil
202
- if disk_config[:disk_type].nil?
228
+ if disk_config[:autodelete_disk].nil?
203
229
  # Default auto delete to true
204
230
  additional_disk_auto_delete = true
205
231
  else
@@ -241,23 +267,33 @@ module VagrantPlugins
241
267
  end
242
268
 
243
269
  defaults = {
244
- :name => name,
245
- :zone => zone,
246
- :machine_type => machine_type,
247
- :disk_size => disk_size,
248
- :disk_type => disk_type,
249
- :image => image,
250
- :network_interfaces => network_interfaces,
251
- :metadata => { :items => metadata.each.map { |k, v| {:key => k.to_s, :value => v.to_s} } },
252
- :labels => labels,
253
- :tags => { :items => tags },
254
- :can_ip_forward => can_ip_forward,
255
- :use_private_ip => use_private_ip,
256
- :external_ip => external_ip,
257
- :disks => disks,
258
- :scheduling => scheduling,
259
- :service_accounts => service_accounts
270
+ :name => name,
271
+ :zone => zone,
272
+ :machine_type => machine_type,
273
+ :disk_size => disk_size,
274
+ :disk_type => disk_type,
275
+ :image => image,
276
+ :network_interfaces => network_interfaces,
277
+ :metadata => { :items => metadata.each.map { |k, v| { :key => k.to_s, :value => v.to_s } } },
278
+ :labels => labels,
279
+ :tags => { :items => tags },
280
+ :can_ip_forward => can_ip_forward,
281
+ :use_private_ip => use_private_ip,
282
+ :external_ip => external_ip,
283
+ :network_ip => network_ip,
284
+ :disks => disks,
285
+ :scheduling => scheduling,
286
+ :service_accounts => service_accounts,
287
+ :guest_accelerators => accelerators_url
260
288
  }
289
+
290
+ # XXX HACK - only add of the parameters are set in :shielded_instance_config we need to drop the field from
291
+ # the API call otherwise we'll error out with Google::Apis::ClientError
292
+ # TODO(temikus): Remove if the API changes, see internal GOOG ref: b/175063371
293
+ if shielded_instance_config.has_value?(true)
294
+ defaults[:shielded_instance_config] = shielded_instance_config
295
+ end
296
+
261
297
  server = env[:google_compute].servers.create(defaults)
262
298
  @logger.info("Machine '#{zone}:#{name}' created.")
263
299
  rescue *FOG_ERRORS => e
@@ -284,10 +320,26 @@ module VagrantPlugins
284
320
  env[:interrupted] = true
285
321
  end
286
322
 
323
+ # Parse out the image project in case it was not set
324
+ # and check if it is part of a public windows project
325
+ img_project = image.split("/")[6]
326
+ is_windows_image = img_project.eql?("windows-cloud") || img_project.eql?("windows-sql-cloud")
327
+
328
+ # Reset the password if a windows image unless flag overrides
329
+ setup_winrm_password = zone_config.setup_winrm_password
330
+ if setup_winrm_password.nil? && is_windows_image
331
+ setup_winrm_password = true
332
+ end
333
+
334
+ if setup_winrm_password
335
+ env[:ui].info("Setting up WinRM Password")
336
+ env[:action_runner].run(Action.action_setup_winrm_password, env)
337
+ end
338
+
287
339
  unless env[:terminated]
288
- env[:metrics]["instance_ssh_time"] = Util::Timer.time do
289
- # Wait for SSH to be ready.
290
- env[:ui].info(I18n.t("vagrant_google.waiting_for_ssh"))
340
+ env[:metrics]["instance_comm_time"] = Util::Timer.time do
341
+ # Wait for Comms to be ready.
342
+ env[:ui].info(I18n.t("vagrant_google.waiting_for_comm"))
291
343
  while true
292
344
  # If we're interrupted just back out
293
345
  break if env[:interrupted]
@@ -295,8 +347,8 @@ module VagrantPlugins
295
347
  sleep 2
296
348
  end
297
349
  end
298
- @logger.info("Time for SSH ready: #{env[:metrics]["instance_ssh_time"]}")
299
- env[:ui].info(I18n.t("vagrant_google.ready_ssh")) unless env[:interrupted]
350
+ @logger.info("Time for Comms ready: #{env[:metrics]["instance_comm_time"]}")
351
+ env[:ui].info(I18n.t("vagrant_google.ready_comm")) unless env[:interrupted]
300
352
  end
301
353
 
302
354
  # Terminate the instance if we were interrupted