зеркало из https://github.com/Azure/vagrant-azure.git
#161 Allow the creation of custom (opened) TCP endpoints.
This commit is contained in:
Родитель
b7f1ae4d47
Коммит
a1a135587b
|
@ -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 %>
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче