kitchen-azurerm 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/README.md +11 -29
- data/lib/kitchen/driver/azurerm.rb +4 -0
- data/lib/kitchen/driver/credentials.rb +25 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b74bca4d62cfed46b2324573d6a855ae063b77904f3a9bfb9c4daefd4f292ab9
|
4
|
+
data.tar.gz: 8e634aef438292cbca56180e73938a756a0f480e6c0189ec03d9958c4e82db76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 169c9351866ec61413c0d0466a427598b8678d7a728a764712d48474814ac7f7e21d8650d58dac8a7494134e293485d06cfd5886a494ca299bb5e2c871703017
|
7
|
+
data.tar.gz: 322cdbfebcffa928f6ae37912cdc82038160f2252e451688ec27d3fca548bd17eba7385082827b77f2311956dfdd537335f57ffa9bb6a89002d6b9b668429312
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# kitchen-azurerm Changelog
|
2
2
|
|
3
|
+
## [0.14.1] - 2018-05-10
|
4
|
+
- Support for soverign clouds with latest Azure SDK for Ruby, fixes [#79](https://github.com/test-kitchen/kitchen-azurerm/issues/79)
|
5
|
+
- Raise error when subscription_id is not available, fixes [#74](https://github.com/test-kitchen/kitchen-azurerm/issues/74)
|
6
|
+
|
3
7
|
## [0.14.0] - 2018-04-10
|
4
8
|
- Update Azure SDK to latest version, upgrade to latest build tools
|
5
9
|
|
data/README.md
CHANGED
@@ -56,8 +56,6 @@ Here's an example ```.kitchen.yml``` file that provisions an Ubuntu Server, usin
|
|
56
56
|
---
|
57
57
|
driver:
|
58
58
|
name: azurerm
|
59
|
-
|
60
|
-
driver_config:
|
61
59
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
62
60
|
location: 'West Europe'
|
63
61
|
machine_size: 'Standard_D1'
|
@@ -70,7 +68,7 @@ provisioner:
|
|
70
68
|
|
71
69
|
platforms:
|
72
70
|
- name: ubuntu-14.04
|
73
|
-
|
71
|
+
driver:
|
74
72
|
image_urn: Canonical:UbuntuServer:14.04.4-LTS:latest
|
75
73
|
vm_name: trusty-vm
|
76
74
|
vm_tags:
|
@@ -99,8 +97,6 @@ Here's a further example ```.kitchen.yml``` file that will provision a Windows S
|
|
99
97
|
---
|
100
98
|
driver:
|
101
99
|
name: azurerm
|
102
|
-
|
103
|
-
driver_config:
|
104
100
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
105
101
|
location: 'West Europe'
|
106
102
|
machine_size: 'Standard_D1'
|
@@ -110,7 +106,7 @@ provisioner:
|
|
110
106
|
|
111
107
|
platforms:
|
112
108
|
- name: windows2012-r2
|
113
|
-
|
109
|
+
driver:
|
114
110
|
image_urn: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
|
115
111
|
transport:
|
116
112
|
name: winrm
|
@@ -133,8 +129,6 @@ These resources will be created in the same Azure Resource Group as the VM under
|
|
133
129
|
---
|
134
130
|
driver:
|
135
131
|
name: azurerm
|
136
|
-
|
137
|
-
driver_config:
|
138
132
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
139
133
|
location: 'West Europe'
|
140
134
|
machine_size: 'Standard_D1'
|
@@ -150,7 +144,7 @@ provisioner:
|
|
150
144
|
|
151
145
|
platforms:
|
152
146
|
- name: ubuntu-1404
|
153
|
-
|
147
|
+
driver:
|
154
148
|
image_urn: Canonical:UbuntuServer:14.04.4-LTS:latest
|
155
149
|
|
156
150
|
suites:
|
@@ -199,7 +193,7 @@ Example predeploy.json:
|
|
199
193
|
|
200
194
|
### .kitchen.yml example 4 - deploy VM to existing virtual network/subnet (use for ExpressRoute/VPN scenarios)
|
201
195
|
|
202
|
-
The following example introduces the ```vnet_id``` and ```subnet_id``` properties under
|
196
|
+
The following example introduces the ```vnet_id``` and ```subnet_id``` properties under "driver" in the configuration file. This can be applied at the top level, or per platform.
|
203
197
|
You can use this capability to create the VM on an existing virtual network and subnet created in a different resource group.
|
204
198
|
|
205
199
|
In this case, the public IP address is not used unless ```public_ip``` is set to ```true```
|
@@ -209,8 +203,6 @@ In this case, the public IP address is not used unless ```public_ip``` is set to
|
|
209
203
|
---
|
210
204
|
driver:
|
211
205
|
name: azurerm
|
212
|
-
|
213
|
-
driver_config:
|
214
206
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
215
207
|
location: 'West Europe'
|
216
208
|
machine_size: 'Standard_D1'
|
@@ -223,7 +215,7 @@ provisioner:
|
|
223
215
|
|
224
216
|
platforms:
|
225
217
|
- name: ubuntu-1404
|
226
|
-
|
218
|
+
driver:
|
227
219
|
image_urn: Canonical:UbuntuServer:14.04.4-LTS:latest
|
228
220
|
vnet_id: /subscriptions/b6e7eee9-YOUR-GUID-HERE-03ab624df016/resourceGroups/pendrica-infrastructure/providers/Microsoft.Network/virtualNetworks/pendrica-arm-vnet
|
229
221
|
subnet_id: subnet-10.1.0
|
@@ -245,8 +237,6 @@ Note: The image must be available first. On deletion the disk and everything is
|
|
245
237
|
---
|
246
238
|
driver:
|
247
239
|
name: azurerm
|
248
|
-
|
249
|
-
driver_config:
|
250
240
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
251
241
|
location: 'West Europe'
|
252
242
|
machine_size: 'Standard_D1'
|
@@ -259,7 +249,7 @@ provisioner:
|
|
259
249
|
|
260
250
|
platforms:
|
261
251
|
- name: ubuntu-1404
|
262
|
-
|
252
|
+
driver:
|
263
253
|
image_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RESGROUP/providers/Microsoft.Compute/images/IMAGENAME
|
264
254
|
vnet_id: /subscriptions/b6e7eee9-YOUR-GUID-HERE-03ab624df016/resourceGroups/pendrica-infrastructure/providers/Microsoft.Network/virtualNetworks/pendrica-arm-vnet
|
265
255
|
subnet_id: subnet-10.1.0
|
@@ -290,8 +280,6 @@ This example will:
|
|
290
280
|
---
|
291
281
|
driver:
|
292
282
|
name: azurerm
|
293
|
-
|
294
|
-
driver_config:
|
295
283
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
296
284
|
location: 'West Europe'
|
297
285
|
machine_size: 'Standard_D1'
|
@@ -304,7 +292,7 @@ provisioner:
|
|
304
292
|
|
305
293
|
platforms:
|
306
294
|
- name: ubuntu-1404
|
307
|
-
|
295
|
+
driver:
|
308
296
|
image_url: https://yourstorageaccount.blob.core.windows.net/system/Microsoft.Compute/Images/images/Cent7_P4-osDisk.170dd1b7-7dc3-4496-b248-f47c49f63965.vhd
|
309
297
|
existing_storage_account_blob_url: https://yourstorageaccount.blob.core.windows.net
|
310
298
|
os_type: linux
|
@@ -330,8 +318,6 @@ Note: Custom data can be custom data or a file to custom data. Please also note
|
|
330
318
|
---
|
331
319
|
driver:
|
332
320
|
name: azurerm
|
333
|
-
|
334
|
-
driver_config:
|
335
321
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
336
322
|
location: 'West Europe'
|
337
323
|
machine_size: 'Standard_D1'
|
@@ -344,7 +330,7 @@ provisioner:
|
|
344
330
|
|
345
331
|
platforms:
|
346
332
|
- name: ubuntu-1404
|
347
|
-
|
333
|
+
driver:
|
348
334
|
image_url: https://yourstorageaccount.blob.core.windows.net/system/Microsoft.Compute/Images/images/Cent7_P4-osDisk.170dd1b7-7dc3-4496-b248-f47c49f63965.vhd
|
349
335
|
existing_storage_account_blob_url: https://yourstorageaccount.blob.core.windows.net
|
350
336
|
os_type: linux
|
@@ -377,8 +363,6 @@ Note the availability of a `format_data_disks` option (default: `false`). When
|
|
377
363
|
---
|
378
364
|
driver:
|
379
365
|
name: azurerm
|
380
|
-
|
381
|
-
driver_config:
|
382
366
|
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
|
383
367
|
location: 'West Europe'
|
384
368
|
machine_size: 'Standard_F2s'
|
@@ -388,7 +372,7 @@ provisioner:
|
|
388
372
|
|
389
373
|
platforms:
|
390
374
|
- name: windows2016-noformat
|
391
|
-
|
375
|
+
driver:
|
392
376
|
image_urn: MicrosoftWindowsServer:WindowsServer:2016-Datacenter:latest
|
393
377
|
data_disks:
|
394
378
|
- lun: 0
|
@@ -418,8 +402,6 @@ Note that the ```use_managed_disks``` option should be set to false until suppor
|
|
418
402
|
---
|
419
403
|
driver:
|
420
404
|
name: azurerm
|
421
|
-
|
422
|
-
driver_config:
|
423
405
|
subscription_id: 'abcdabcd-YOUR-GUID-HERE-abcdabcdabcd'
|
424
406
|
azure_environment: 'AzureUSGovernment'
|
425
407
|
location: 'US Gov Iowa'
|
@@ -434,7 +416,7 @@ verifier:
|
|
434
416
|
|
435
417
|
platforms:
|
436
418
|
- name: ubuntu1604
|
437
|
-
|
419
|
+
driver:
|
438
420
|
image_urn: Canonical:UbuntuServer:16.04-LTS:latest
|
439
421
|
transport:
|
440
422
|
ssh_key: ~/.ssh/id_kitchen-azurerm
|
@@ -480,7 +462,7 @@ info: vm image list command OK
|
|
480
462
|
```
|
481
463
|
|
482
464
|
### Additional parameters:
|
483
|
-
- Note that the ```
|
465
|
+
- Note that the ```driver``` section also takes a ```username``` and ```password``` parameter, the defaults if these are not specified are "azure" and "P2ssw0rd" respectively.
|
484
466
|
- The ```storage_account_type``` parameter defaults to 'Standard_LRS' and allows you to switch to premium storage (e.g. 'Premium_LRS')
|
485
467
|
- The ```enable_boot_diagnostics``` parameter defaults to 'true' and allows you to switch off boot diagnostics in case you are using premium storage.
|
486
468
|
- The optional ```vm_tags``` parameter allows you to define key:value pairs to tag VMs with on creation.
|
@@ -148,6 +148,10 @@ module Kitchen
|
|
148
148
|
vmName: state[:vm_name]
|
149
149
|
}
|
150
150
|
|
151
|
+
if config[:subscription_id].to_s == ''
|
152
|
+
raise 'A subscription_id config value was not detected and kitchen-azurerm cannot continue. Please check your .kitchen.yml configuration. Exiting.'
|
153
|
+
end
|
154
|
+
|
151
155
|
if config[:custom_data].to_s != ''
|
152
156
|
deployment_parameters['customData'] = prepared_custom_data
|
153
157
|
end
|
@@ -33,22 +33,24 @@ module Kitchen
|
|
33
33
|
tenant_id = ENV['AZURE_TENANT_ID'] || @credentials[subscription_id]['tenant_id']
|
34
34
|
client_id = ENV['AZURE_CLIENT_ID'] || @credentials[subscription_id]['client_id']
|
35
35
|
client_secret = ENV['AZURE_CLIENT_SECRET'] || @credentials[subscription_id]['client_secret']
|
36
|
-
token_provider = ::MsRestAzure::ApplicationTokenProvider.new(tenant_id, client_id, client_secret,
|
36
|
+
token_provider = ::MsRestAzure::ApplicationTokenProvider.new(tenant_id, client_id, client_secret, ad_settings_for_azure_environment(azure_environment))
|
37
37
|
options = { tenant_id: tenant_id,
|
38
38
|
client_id: client_id,
|
39
39
|
client_secret: client_secret,
|
40
40
|
subscription_id: subscription_id,
|
41
|
-
credentials: ::MsRest::TokenCredentials.new(token_provider)
|
41
|
+
credentials: ::MsRest::TokenCredentials.new(token_provider),
|
42
|
+
active_directory_settings: ad_settings_for_azure_environment(azure_environment),
|
43
|
+
base_url: endpoint_settings_for_azure_environment(azure_environment).resource_manager_endpoint_url }
|
42
44
|
options
|
43
45
|
end
|
44
46
|
|
45
47
|
#
|
46
|
-
# Retrieves a [MsRestAzure::ActiveDirectoryServiceSettings] object representing the settings for the given cloud.
|
48
|
+
# Retrieves a [MsRestAzure::ActiveDirectoryServiceSettings] object representing the AD settings for the given cloud.
|
47
49
|
# @param azure_environment [String] The Azure environment to retrieve settings for.
|
48
50
|
#
|
49
51
|
# @return [MsRestAzure::ActiveDirectoryServiceSettings] Settings to be used for subsequent requests
|
50
52
|
#
|
51
|
-
def
|
53
|
+
def ad_settings_for_azure_environment(azure_environment)
|
52
54
|
case azure_environment.downcase
|
53
55
|
when 'azureusgovernment'
|
54
56
|
::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_us_government_settings
|
@@ -61,6 +63,25 @@ module Kitchen
|
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
66
|
+
#
|
67
|
+
# Retrieves a [MsRestAzure::AzureEnvironment] object representing endpoint settings for the given cloud.
|
68
|
+
# @param azure_environment [String] The Azure environment to retrieve settings for.
|
69
|
+
#
|
70
|
+
# @return [MsRestAzure::AzureEnvironment] Settings to be used for subsequent requests
|
71
|
+
#
|
72
|
+
def endpoint_settings_for_azure_environment(azure_environment)
|
73
|
+
case azure_environment.downcase
|
74
|
+
when 'azureusgovernment'
|
75
|
+
::MsRestAzure::AzureEnvironments::AzureUSGovernment
|
76
|
+
when 'azurechina'
|
77
|
+
::MsRestAzure::AzureEnvironments::AzureChinaCloud
|
78
|
+
when 'azuregermancloud'
|
79
|
+
::MsRestAzure::AzureEnvironments::AzureGermanCloud
|
80
|
+
when 'azure'
|
81
|
+
::MsRestAzure::AzureEnvironments::AzureCloud
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
64
85
|
def self.singleton
|
65
86
|
@credentials ||= Credentials.new
|
66
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-azurerm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Preston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: azure_mgmt_network
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
182
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.6
|
183
|
+
rubygems_version: 2.7.6
|
184
184
|
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: Test Kitchen driver for Azure Resource Manager.
|