Azure Network Endpoint
This page shows how to write Terraform and Azure Resource Manager for Network Endpoint and write them securely.
azurerm_traffic_manager_endpoint (Terraform)
The Endpoint in Network can be configured in Terraform with the resource name azurerm_traffic_manager_endpoint
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_traffic_manager_endpoint" "endpoint" {
name = var.name
resource_group_name = var.resource_group
profile_name = var.traffic_manager
target = var.target
type = var.target_type
resource "azurerm_traffic_manager_endpoint" "scepman_primary_region" {
name = "scepman-primary-region"
resource_group_name = azurerm_resource_group.resource_group.name
profile_name = azurerm_traffic_manager_profile.scepman_traffic_manager.name
type = "azureEndpoints"
target_resource_id = lookup(azurerm_template_deployment.scepman.outputs, "appServiceID")
resource "azurerm_traffic_manager_endpoint" "cdnendpointbr" {
name = "trafficbr"
resource_group_name = azurerm_resource_group.rg.name
profile_name = azurerm_traffic_manager_profile.trafficprofile.name
target_resource_id = azurerm_app_service.appservicebr.id
type = "azureEndpoints"
resource "azurerm_traffic_manager_endpoint" "traffic_manager_main" {
name = "traffic_manager_main"
resource_group_name = azurerm_resource_group.rg1.name
profile_name = azurerm_traffic_manager_profile.traffic_manager.name
target = "esgi-ben-part3-rg1.westeurope.cloudapp.azure.com"
type = "externalEndpoints"
Parameters
-
endpoint_location
optional computed - string -
endpoint_monitor_status
optional computed - string -
endpoint_status
optional computed - string -
geo_mappings
optional - list of string -
id
optional computed - string -
min_child_endpoints
optional - number -
name
required - string -
priority
optional computed - number -
profile_name
required - string -
resource_group_name
required - string -
target
optional computed - string -
target_resource_id
optional - string -
type
required - string -
weight
optional computed - number -
custom_header
list block -
subnet
list block -
timeouts
single block
Explanation in Terraform Registry
Manages a Traffic Manager Endpoint.
Tips: Best Practices for The Other Azure Network Resources
In addition to the azurerm_network_security_group, Azure Network has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_network_security_group
Ensure to disable RDP port from the Internet
It is better to disable the RDP port from the Internet. RDP access should not be accepted from the Internet (*, 0.0.0.0, /0, internet, any), and consider using the Azure Bastion Service.
azurerm_network_security_rule
Ensure to set a more restrictive CIDR range for ingress from the internet
It is better to set a more restrictive CIDR range not to use very broad subnets. If possible, segments should be divided into smaller subnets.
azurerm_network_watcher_flow_log
Ensure to enable Retention policy for flow logs and set it to enough duration
It is better to enable a retention policy for flow logs. Flow logs show us all network activity in the cloud environment and support us when we face critical incidents.
Microsoft.Network/trafficManagerProfiles (Azure Resource Manager)
The trafficManagerProfiles in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/trafficManagerProfiles
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[concat(parameters('webAppDnsNamePrefix'),'-tm')]",
"location": "global",
"dependsOn": [
"siteCopy"
],
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[concat(parameters('webAppDnsNamePrefix'),'-tm')]",
"location": "global",
"dependsOn": [
"siteCopy"
],
"type": "Microsoft.Network/trafficManagerProfiles",
"apiVersion": "2015-11-01",
"location": "global",
"dependsOn": [
"siteCopy"
],
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[parameters('customSettings').trafficManagerName]",
"apiVersion": "[parameters('apiSettings').trafficManagerApiversion]",
"location": "global",
"properties": {
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "ExternalEndpointExample",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "ExternalEndpointExample",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Weighted",
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "ExternalEndpointExample",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"Type": "Microsoft.Network/trafficManagerProfiles",
"ResourceType": "Microsoft.Network/trafficManagerProfiles",
"ExtensionResourceType": null,
"Sku": null,
"Tags": {},
"SubscriptionId": "00000000-0000-0000-0000-000000000000"
"type": "Microsoft.Network/trafficManagerProfiles"
}
}
}
},
"NameAvailabilityTest_NameNotAvailablePOST23": {
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[parameters('customSettings').trafficManagerName]",
"apiVersion": "[parameters('apiSettings').trafficManagerApiversion]",
"location": "global",
"properties": {
Frequently asked questions
What is Azure Network Endpoint?
Azure Network Endpoint is a resource for Network of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Network Endpoint?
For Terraform, the saiive/saiive.supernode, dipolimene/Template-Samples and higorbarbosa/treinamento-terraform-azure source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the santoshdata/ARMTemp, santoshdata/ARMTemp and santoshdata/ARMTemp source code examples are useful. See the Azure Resource Manager Example section for further details.