vagrant-azure 2.0.0.pre3 → 2.0.0.pre4

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
2
  SHA1:
3
- metadata.gz: 500531015ee4b9fa81557c8398f1fed55455cc4c
4
- data.tar.gz: dec5502ea4dab238bb49cd61b2559102ad4eada6
3
+ metadata.gz: b2240c2e25fcd88a3260ac97f911b5e49f6834c8
4
+ data.tar.gz: e46e404e33a825af6c197bc5484f9bae86051275
5
5
  SHA512:
6
- metadata.gz: 2dce397adb9a233f7294d3f857e7de47c192b76a4da0f959e826a0ca449015bba6984d655d6a23d19d4d7a83e027f92facf35ba55cf084855d91dfe8f82c509b
7
- data.tar.gz: 18d6a73dd73b31e4cafa27b29aaffcfb626653d6f6e36a7aab6a49853658872faadc6ae94b87c26456280b40b5dbe838ce973426eac029c3fd98cc9569902329
6
+ metadata.gz: 594d5b68122d7c21dd1dfecea569a46419b3cce72724e949cdd2d5e0761519cc1a42aad687b42a9787d2d1891808e2477ae44973ad3e37d9ef3c05120b8cc07d
7
+ data.tar.gz: afd27c10c848e763473c15611d8841cbe81dcdd914a7924ab935c6f46107f11f09ae0cbca8b75034e174e7bc79d895ca37aef69425bd1fd795b93ea581443f1e
data/.gitignore CHANGED
@@ -18,3 +18,5 @@ modules/
18
18
  .ruby-version
19
19
  *.ps1
20
20
  .env
21
+ .bundle
22
+
data/README.md CHANGED
@@ -124,6 +124,10 @@ For instructions on how to setup an Azure Active Directory Application see: <htt
124
124
  * `vm_image_urn`: (Optional) Name of the virtual machine image urn to use -- defaults to 'canonical:ubuntuserver:16.04-LTS:latest'. See documentation for [*nix](https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-cli-ps-findimage/), [Windows](https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-cli-ps-findimage).
125
125
  * `virtual_network_name`: (Optional) Name of the virtual network resource
126
126
  * `subnet_name`: (Optional) Name of the virtual network subnet resource
127
+ * `tcp_endpoints`: (Optional) The custom inbound security rules part of network security group (a.k.a. opened tcp endpoints). Allows specifying one or more intervals in the form of:
128
+ * an array `['8000-9000', '9100-9200']`,
129
+ * a single interval as `'8000-9000'`,
130
+ * a single port as `8000`.
127
131
  * `instance_ready_timeout`: (Optional) The timeout to wait for an instance to become ready -- default 120 seconds.
128
132
  * `instance_check_interval`: (Optional) The interval to wait for checking an instance's state -- default 2 seconds.
129
133
  * `endpoint`: (Optional) The Azure Management API endpoint -- default `ENV['AZURE_MANAGEMENT_ENDPOINT']` if exists, falls back to <https://management.azure.com>.
@@ -124,6 +124,24 @@ module VagrantPlugins
124
124
  deployment_params.merge!(windows_params)
125
125
  end
126
126
 
127
+ unless tcp_endpoints.nil?
128
+
129
+ if tcp_endpoints.is_a?(Array)
130
+ # https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-nsg#Nsg-rules
131
+ if tcp_endpoints.length + 133 > 4096
132
+ raise I18n.t('vagrant_azure.too_many_tcp_endpoints', count: tcp_endpoints.length)
133
+ end
134
+ endpoints = tcp_endpoints
135
+ elsif tcp_endpoints.is_a?(String) || (tcp_endpoints.is_a?(Integer) && tcp_endpoints > 0)
136
+ endpoints = [tcp_endpoints]
137
+ else
138
+ raise I18n.t('vagrant_azure.unknown_type_as_tcp_endpoints', input: tcp_endpoints)
139
+ end
140
+ else
141
+ endpoints = []
142
+ end
143
+ template_params.merge!(endpoints: endpoints)
144
+
127
145
  env[:ui].info(" -- Create or Update of Resource Group: #{resource_group_name}")
128
146
  env[:metrics]['put_resource_group'] = Util::Timer.time do
129
147
  put_resource_group(azure, resource_group_name, location)
@@ -191,7 +209,8 @@ module VagrantPlugins
191
209
  end
192
210
 
193
211
  def put_deployment(azure, rg_name, params)
194
- azure.resources.deployments.create_or_update(rg_name, 'vagrant', params)
212
+ deployment_name = "vagrant_#{Time.now.getutc.strftime('%Y%m%d%H%M%S')}"
213
+ azure.resources.deployments.create_or_update(rg_name, deployment_name, params)
195
214
  end
196
215
 
197
216
  def put_resource_group(azure, name, location)
@@ -12,6 +12,7 @@ module VagrantPlugins
12
12
  module Services
13
13
  class AzureResourceManager
14
14
 
15
+ TELEMETRY = "vagrant-azure/#{VagrantPlugins::Azure::VERSION}"
15
16
  TENANT_ID_NAME = 'AZURE_TENANT_ID'
16
17
  CLIENT_ID_NAME = 'AZURE_CLIENT_ID'
17
18
  CLIENT_SECRET_NAME = 'AZURE_CLIENT_SECRET'
@@ -68,6 +69,7 @@ module VagrantPlugins
68
69
  def build(clazz)
69
70
  instance = clazz.new(*client_params)
70
71
  instance.subscription_id = @subscription_id
72
+ instance.add_user_agent_information(TELEMETRY)
71
73
  instance
72
74
  end
73
75
 
@@ -4,6 +4,6 @@
4
4
 
5
5
  module VagrantPlugins
6
6
  module Azure
7
- VERSION = '2.0.0.pre3'.freeze
7
+ VERSION = '2.0.0.pre4'.freeze
8
8
  end
9
9
  end
data/locales/en.yml CHANGED
@@ -104,6 +104,12 @@ en:
104
104
  Please specify a secure key to use with config.ssh.private_key_path
105
105
  (see: https://www.vagrantup.com/docs/vagrantfile/ssh_settings.html).
106
106
  If not, you publicly accessible Azure VM will be extremely insecure.
107
+ too_many_tcp_endpoints: |-
108
+ There are '%{count}' TCP Endpoints (Inbound Security Rules) specified for the NetworkSecurityGroup, which is too many.
109
+ There can be a max of 3963 (4096 - 133, where 133 is where we start as priority for custom rule #1, and so forth)
110
+ (see: https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-nsg#Nsg-rules)
111
+ unknown_type_as_tcp_endpoints: |-
112
+ Unrecognized setting '%{input}' as TCP Endpoints (Inbounds Security Rules), expected an array, string or positive number.
107
113
  waiting_for_ready: |-
108
114
  Waiting for instance to become "ready"...
109
115
  waiting_for_stop: |-
@@ -173,7 +173,24 @@
173
173
  "direction": "Inbound"
174
174
  }
175
175
  }
176
- <% end %>
176
+ <% end %>
177
+ <% endpoints.each_with_index do |ports, index| %>
178
+ ,
179
+ {
180
+ "name": "custom_rule_<%= index %>",
181
+ "properties": {
182
+ "description": "Custom opened ports.",
183
+ "protocol": "Tcp",
184
+ "sourcePortRange": "*",
185
+ "destinationPortRange": "<%= ports %>",
186
+ "sourceAddressPrefix": "*",
187
+ "destinationAddressPrefix": "*",
188
+ "access": "Allow",
189
+ "priority": <%= 133 + index %>,
190
+ "direction": "Inbound"
191
+ }
192
+ }
193
+ <% end %>
177
194
  ]
178
195
  }
179
196
  },
@@ -319,4 +336,4 @@
319
336
  }
320
337
  }
321
338
  ]
322
- }
339
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre3
4
+ version: 2.0.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Azure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: azure_mgmt_resources