#161 Allow the creation of custom (opened) TCP endpoints.

This commit is contained in:
Dan Danciu 2017-02-17 01:34:21 +02:00
Родитель b7f1ae4d47
Коммит a1a135587b
4 изменённых файлов: 29 добавлений и 2 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -18,3 +18,5 @@ modules/
.ruby-version
*.ps1
.env
.bundle

Просмотреть файл

@ -124,6 +124,7 @@ For instructions on how to setup an Azure Active Directory Application see: <htt
* `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).
* `virtual_network_name`: (Optional) Name of the virtual network resource
* `subnet_name`: (Optional) Name of the virtual network subnet resource
* `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 '8000-9000, 9100-9200'.
* `instance_ready_timeout`: (Optional) The timeout to wait for an instance to become ready -- default 120 seconds.
* `instance_check_interval`: (Optional) The interval to wait for checking an instance's state -- default 2 seconds.
* `endpoint`: (Optional) The Azure Management API endpoint -- default `ENV['AZURE_MANAGEMENT_ENDPOINT']` if exists, falls back to <https://management.azure.com>.

Просмотреть файл

@ -124,6 +124,13 @@ module VagrantPlugins
deployment_params.merge!(windows_params)
end
unless tcp_endpoints.nil? || tcp_endpoints.empty?
endpoints = tcp_endpoints.split(',')
else
endpoints = {}
end
template_params.merge!(endpoints: endpoints)
env[:ui].info(" -- Create or Update of Resource Group: #{resource_group_name}")
env[:metrics]['put_resource_group'] = Util::Timer.time do
put_resource_group(azure, resource_group_name, location)

Просмотреть файл

@ -173,7 +173,24 @@
"direction": "Inbound"
}
}
<% end %>
<% end %>
<% endpoints.each_with_index do |ports, index| %>
,
{
"name": "custom_rule_<%= index %>",
"properties": {
"description": "Custom opened ports.",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "<%= ports %>",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": <%= 133 + index %>,
"direction": "Inbound"
}
}
<% end %>
]
}
},