kitchen-azurerm 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +54 -26
- data/lib/kitchen/driver/azurerm.rb +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c53c5b50e83af16c56722ecbc2baa30b5a28621cc17f4edde82a59b22420812f
|
4
|
+
data.tar.gz: cd39338fdf0d29d39780e93b6a9fc8c27cd955daf59b6fc79f3be56801c7d891
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d62cae11a2fa2a679657fc9c81e6b03547802cd7773f6b801b644388beb09b6fe44de2f0d5f2e9a1601cf3eee92b7a2d86e1f29e7dd86b09e3e6445fdceaebd5
|
7
|
+
data.tar.gz: 8bbccc8d27fef365420257f9a11d89cd8b326cf6e60c97e737c1fe304b14f28ee543793c314e9e638096b606c6ccc64986e7d4db94345d53463981b84eadc931
|
data/README.md
CHANGED
@@ -10,15 +10,34 @@ This version has been tested on Windows, macOS, and Ubuntu. If you encounter a p
|
|
10
10
|
|
11
11
|
### Installation
|
12
12
|
|
13
|
-
This plugin is
|
13
|
+
This plugin ships in Chef Workstation out of the box so there is no need to install it when using Chef Workstation[https://downloads.chef.io/products/workstation].
|
14
14
|
|
15
|
-
|
15
|
+
If you're not using Chef Workstation and need to install the plugin as a gem run:
|
16
16
|
|
17
|
-
|
17
|
+
```$ gem install kitchen-azurerm```
|
18
18
|
|
19
19
|
### Configuration
|
20
20
|
|
21
|
-
For the driver to interact with the Microsoft Azure Resource management REST API, a Service Principal needs to be configured with Contributor rights against the specific subscription being targeted. Using an Organizational (AAD) account and related password is no longer supported. To create a Service Principal and apply the correct permissions, you will need to [create
|
21
|
+
For the driver to interact with the Microsoft Azure Resource management REST API, a Service Principal needs to be configured with Contributor rights against the specific subscription being targeted. Using an Organizational (AAD) account and related password is no longer supported. To create a Service Principal and apply the correct permissions, you will need to [create an Azure service principal with the Azure CLI](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest#create-a-service-principal) using the [Azure CLI](https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/). Make sure you stay within the section titled 'Authenticate service principal with password - Azure CLI'.
|
22
|
+
|
23
|
+
If the above is TLDR then try this after `az login` using your target subscription ID and the desired SP name:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
# Create a Service Principal using the desired subscription id from the command above
|
27
|
+
az ad sp create-for-rbac --name="kitchen-azurerm" --role="Contributor" --scopes="/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
28
|
+
|
29
|
+
#Output
|
30
|
+
#
|
31
|
+
#{
|
32
|
+
# "appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", <- Also known as the Client ID
|
33
|
+
# "displayName": "azure-cli-2018-12-12-14-15-39",
|
34
|
+
# "name": "http://azure-cli-2018-12-12-14-15-39",
|
35
|
+
# "password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
36
|
+
# "tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
37
|
+
#}
|
38
|
+
```
|
39
|
+
|
40
|
+
NOTE: Don't forget to save the values from the output -- most importantly the `password`.
|
22
41
|
|
23
42
|
You will also need to ensure you have an active Azure subscription (you can get started [for free](https://azure.microsoft.com/en-us/free/) or use your [MSDN Subscription](https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits/)).
|
24
43
|
|
@@ -32,22 +51,31 @@ You are now ready to configure kitchen-azurerm to use the credentials from the s
|
|
32
51
|
Using a text editor, open or create the file ```~/.azure/credentials``` and add the following section, noting there is one section per Subscription ID. **Make sure you save the file with UTF-8 encoding**
|
33
52
|
|
34
53
|
```ruby
|
35
|
-
[
|
36
|
-
client_id = "
|
54
|
+
[ADD-YOUR-AZURE-SUBSCRIPTION-ID-HERE-IN-SQUARE-BRACKET]
|
55
|
+
client_id = "your-azure-client-id-here"
|
37
56
|
client_secret = "your-client-secret-here"
|
38
|
-
tenant_id = "
|
57
|
+
tenant_id = "your-azure-tenant-id-here"
|
39
58
|
```
|
40
59
|
|
41
60
|
If preferred, you may also set the following environment variables, however this would be incompatible with supporting multiple Azure subscriptions.
|
42
61
|
|
43
62
|
```ruby
|
44
|
-
AZURE_CLIENT_ID="
|
63
|
+
AZURE_CLIENT_ID="your-azure-client-id-here"
|
45
64
|
AZURE_CLIENT_SECRET="your-client-secret-here"
|
46
|
-
AZURE_TENANT_ID="
|
65
|
+
AZURE_TENANT_ID="your-azure-tenant-id-here"
|
47
66
|
```
|
48
67
|
|
49
68
|
Note that the environment variables, if set, take preference over the values in a configuration file.
|
50
69
|
|
70
|
+
After adjusting your ```~/.azure/credentials``` file you will need to adjust your ```kitchen.yml``` file to leverage the azurerm driver. Use the following examples to achieve this, then check your configuration with standard kitchen commands. For example,
|
71
|
+
|
72
|
+
```bash
|
73
|
+
% kitchen list
|
74
|
+
Instance Driver Provisioner Verifier Transport Last Action Last Error
|
75
|
+
wsus-windows-2019 Azurerm ChefZero Inspec Winrm <Not Created> <None>
|
76
|
+
wsus-windows-2016 Azurerm ChefZero Inspec Winrm <Not Created> <None>
|
77
|
+
```
|
78
|
+
|
51
79
|
### .kitchen.yml example 1 - Linux/Ubuntu
|
52
80
|
|
53
81
|
Here's an example ```.kitchen.yml``` file that provisions an Ubuntu Server, using Chef Zero as the provisioner and SSH as the transport. Note that if the key does not exist at the specified location, it will be created. Also note that if ```ssh_key``` is supplied, Test Kitchen will use this in preference to any default/configured passwords that are supplied.
|
@@ -56,7 +84,7 @@ Here's an example ```.kitchen.yml``` file that provisions an Ubuntu Server, usin
|
|
56
84
|
---
|
57
85
|
driver:
|
58
86
|
name: azurerm
|
59
|
-
subscription_id: '
|
87
|
+
subscription_id: 'your-azure-subscription-id-here'
|
60
88
|
location: 'West Europe'
|
61
89
|
machine_size: 'Standard_D1'
|
62
90
|
|
@@ -71,9 +99,6 @@ platforms:
|
|
71
99
|
driver:
|
72
100
|
image_urn: Canonical:UbuntuServer:14.04.4-LTS:latest
|
73
101
|
vm_name: trusty-vm
|
74
|
-
vm_tags:
|
75
|
-
ostype: linux
|
76
|
-
distro: ubuntu
|
77
102
|
|
78
103
|
suites:
|
79
104
|
- name: default
|
@@ -98,7 +123,7 @@ Here's a further example ```.kitchen.yml``` file that will provision a Windows S
|
|
98
123
|
---
|
99
124
|
driver:
|
100
125
|
name: azurerm
|
101
|
-
subscription_id: '
|
126
|
+
subscription_id: 'your-subscription-id-here'
|
102
127
|
location: 'West Europe'
|
103
128
|
machine_size: 'Standard_DS2_v2'
|
104
129
|
|
@@ -113,6 +138,9 @@ platforms:
|
|
113
138
|
resource_group_tags:
|
114
139
|
project: 'My Cool Project'
|
115
140
|
contact: 'me@somewhere.com'
|
141
|
+
vm_tags:
|
142
|
+
my_tag: its value
|
143
|
+
another_tag: its awesome value
|
116
144
|
transport:
|
117
145
|
name: winrm
|
118
146
|
suites:
|
@@ -134,7 +162,7 @@ These resources will be created in the same Azure Resource Group as the VM under
|
|
134
162
|
---
|
135
163
|
driver:
|
136
164
|
name: azurerm
|
137
|
-
subscription_id: '
|
165
|
+
subscription_id: 'your-azure-subscription-id-here'
|
138
166
|
location: 'West Europe'
|
139
167
|
machine_size: 'Standard_D1'
|
140
168
|
pre_deployment_template: predeploy.json
|
@@ -207,7 +235,7 @@ In this case, the public IP address is not used unless ```public_ip``` is set to
|
|
207
235
|
---
|
208
236
|
driver:
|
209
237
|
name: azurerm
|
210
|
-
subscription_id: '
|
238
|
+
subscription_id: 'your-azure-subscription-id-here'
|
211
239
|
location: 'West Europe'
|
212
240
|
machine_size: 'Standard_D1'
|
213
241
|
|
@@ -241,7 +269,7 @@ Note: The image must be available first. On deletion the disk and everything is
|
|
241
269
|
---
|
242
270
|
driver:
|
243
271
|
name: azurerm
|
244
|
-
subscription_id: '
|
272
|
+
subscription_id: 'your-azure-subscription-id-here'
|
245
273
|
location: 'West Europe'
|
246
274
|
machine_size: 'Standard_D1'
|
247
275
|
|
@@ -282,7 +310,7 @@ This example will:
|
|
282
310
|
---
|
283
311
|
driver:
|
284
312
|
name: azurerm
|
285
|
-
subscription_id: '
|
313
|
+
subscription_id: 'your-azure-subscription-id-here'
|
286
314
|
location: 'West Europe'
|
287
315
|
machine_size: 'Standard_D1'
|
288
316
|
|
@@ -319,7 +347,7 @@ Note: Custom data can be custom data or a file to custom data. Please also note
|
|
319
347
|
---
|
320
348
|
driver:
|
321
349
|
name: azurerm
|
322
|
-
subscription_id: '
|
350
|
+
subscription_id: 'your-azure-subscription-id-here'
|
323
351
|
location: 'West Europe'
|
324
352
|
machine_size: 'Standard_D1'
|
325
353
|
|
@@ -364,7 +392,7 @@ Note the availability of a `format_data_disks` option (default: `false`). When s
|
|
364
392
|
---
|
365
393
|
driver:
|
366
394
|
name: azurerm
|
367
|
-
subscription_id: '
|
395
|
+
subscription_id: 'your-azure-subscription-id-here'
|
368
396
|
location: 'West Europe'
|
369
397
|
machine_size: 'Standard_F2s'
|
370
398
|
|
@@ -403,7 +431,7 @@ These resources will be created in the same Azure Resource Group as the VM under
|
|
403
431
|
---
|
404
432
|
driver:
|
405
433
|
name: azurerm
|
406
|
-
subscription_id: '
|
434
|
+
subscription_id: 'your-azure-subscription-id-here'
|
407
435
|
location: 'West Europe'
|
408
436
|
machine_size: 'Standard_D1'
|
409
437
|
post_deployment_template: postdeploy.json
|
@@ -488,7 +516,7 @@ See the [Managed identities for Azure resources](https://docs.microsoft.com/en-u
|
|
488
516
|
---
|
489
517
|
driver:
|
490
518
|
name: azurerm
|
491
|
-
subscription_id: '
|
519
|
+
subscription_id: 'your-azure-subscription-id-here'
|
492
520
|
location: 'West Europe'
|
493
521
|
machine_size: 'Standard_D1'
|
494
522
|
|
@@ -521,7 +549,7 @@ This following example introduces ```secret_url```, ```vault_name```, and ```vau
|
|
521
549
|
---
|
522
550
|
driver:
|
523
551
|
name: azurerm
|
524
|
-
subscription_id: '
|
552
|
+
subscription_id: 'your-azure-subscription-id-here'
|
525
553
|
location: 'CentralUS'
|
526
554
|
machine_size: 'Standard_D2s_v3'
|
527
555
|
secret_url: 'https://YOUR-SECRET-PATH'
|
@@ -556,7 +584,7 @@ Note that the ```use_managed_disks``` option should be set to false until suppor
|
|
556
584
|
---
|
557
585
|
driver:
|
558
586
|
name: azurerm
|
559
|
-
subscription_id: '
|
587
|
+
subscription_id: 'your-azure-subscription-id-here'
|
560
588
|
azure_environment: 'AzureUSGovernment'
|
561
589
|
location: 'US Gov Iowa'
|
562
590
|
machine_size: 'Standard_D2_v2_Promo'
|
@@ -616,9 +644,9 @@ data: Canonical UbuntuServer 15.10-DAILY 15.10.201509220 westeurope
|
|
616
644
|
info: vm image list command OK
|
617
645
|
```
|
618
646
|
|
619
|
-
### Additional parameters that can be specified
|
647
|
+
### Additional parameters that can be specified in your `kitchen.yml` or added to your personal `kitchen.local.yml`
|
620
648
|
|
621
|
-
* Note that the ```driver``` section can also
|
649
|
+
* Note that the ```driver``` section can also take explicit values for ```username``` and ```password```. Otherwise, the default username is "azure" and the password is a randomly generated 24 character password that can be found in your local kitchen state file (typically `.kitchen/<instance-name>.yml`) if you require it for any reason.
|
622
650
|
|
623
651
|
* The ```storage_account_type``` parameter defaults to 'Standard_LRS' and allows you to switch to premium storage (e.g. 'Premium_LRS')
|
624
652
|
|
@@ -75,7 +75,7 @@ module Kitchen
|
|
75
75
|
end
|
76
76
|
|
77
77
|
default_config(:password) do |_config|
|
78
|
-
SecureRandom.base64(
|
78
|
+
SecureRandom.base64(25)
|
79
79
|
end
|
80
80
|
|
81
81
|
default_config(:vm_name) do |_config|
|
@@ -225,7 +225,7 @@ module Kitchen
|
|
225
225
|
end
|
226
226
|
|
227
227
|
if config[:subscription_id].to_s == ""
|
228
|
-
raise "A subscription_id config value was not detected and kitchen-azurerm cannot continue. Please check your
|
228
|
+
raise "A subscription_id config value was not detected and kitchen-azurerm cannot continue. Please check your kitchen.yml configuration. Exiting."
|
229
229
|
end
|
230
230
|
|
231
231
|
if config[:nic_name].to_s == ""
|
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: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Preston
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: azure_mgmt_network
|
@@ -212,7 +212,7 @@ homepage: https://github.com/test-kitchen/kitchen-azurerm
|
|
212
212
|
licenses:
|
213
213
|
- Apache-2.0
|
214
214
|
metadata: {}
|
215
|
-
post_install_message:
|
215
|
+
post_install_message:
|
216
216
|
rdoc_options: []
|
217
217
|
require_paths:
|
218
218
|
- lib
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
230
|
rubygems_version: 3.1.2
|
231
|
-
signing_key:
|
231
|
+
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: Test Kitchen driver for Azure Resource Manager.
|
234
234
|
test_files: []
|