Azure Network IP
This page shows how to write Terraform and Azure Resource Manager for Network IP and write them securely.
azurerm_virtual_hub_ip (Terraform)
The IP in Network can be configured in Terraform with the resource name azurerm_virtual_hub_ip. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_virtual_hub_ip" "hub_ip" {
for_each = try(var.virtual_hub_config.hub_ip, {})
name = azurecaf_name.hub_ip[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
private_ip_address = each.value.private_ip_address
resource "azurerm_virtual_hub_ip" "hub_ip" {
for_each = try(var.virtual_hub_config.hub_ip, {})
name = azurecaf_name.hub_ip[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
private_ip_address = each.value.private_ip_address
resource "azurerm_virtual_hub_ip" "hub_ip" {
for_each = try(var.virtual_hub_config.hub_ip, {})
name = azurecaf_name.hub_ip[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
private_ip_address = each.value.private_ip_address
resource "azurerm_virtual_hub_ip" "hub_ip" {
for_each = try(var.virtual_hub_config.hub_ip, {})
name = azurecaf_name.hub_ip[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
private_ip_address = each.value.private_ip_address
Parameters
-
idoptional computed - string -
namerequired - string -
private_ip_addressoptional - string -
private_ip_allocation_methodoptional - string -
public_ip_address_idoptional - string -
subnet_idrequired - string -
virtual_hub_idrequired - string -
timeoutssingle block
Explanation in Terraform Registry
Manages a Virtual Hub IP.
NOTE Virtual Hub IP only supports Standard Virtual Hub without Virtual Wan.
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/virtualHubs/ipConfigurations (Azure Resource Manager)
The virtualHubs/ipConfigurations in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/virtualHubs/ipConfigurations. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
namerequired - stringtyperequired - stringapiVersionrequired - stringpropertiesrequiredprivateIPAddressoptional - stringThe private IP address of the IP configuration.
privateIPAllocationMethodoptional - stringThe private IP address allocation method.
subnetoptionalpropertiesoptionaladdressPrefixrequired - stringThe address prefix for the subnet.
addressPrefixesoptional - arrayList of address prefixes for the subnet.
networkSecurityGroupoptionalidrequired - stringResource ID.
routeTableoptionalidrequired - stringResource ID.
natGatewayoptionalidrequired - stringResource ID.
serviceEndpointsoptional arrayserviceoptional - stringThe type of the endpoint service.
locationsoptional - arrayA list of locations.
serviceEndpointPoliciesoptional arrayidrequired - stringResource ID.
ipAllocationsoptional arrayidrequired - stringResource ID.
delegationsoptional arraypropertiesoptionalserviceNameoptional - stringThe name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers).
namerequired - stringThe name of the resource that is unique within a subnet. This name can be used to access the resource.
privateEndpointNetworkPoliciesoptional - stringEnable or Disable apply network policies on private end point in the subnet.
privateLinkServiceNetworkPoliciesoptional - stringEnable or Disable apply network policies on private link service in the subnet.
namerequired - stringThe name of the resource that is unique within a resource group. This name can be used to access the resource.
publicIPAddressoptionallocationrequired - stringResource location.
tagsoptional - stringResource tags.
extendedLocationoptionalnamerequired - stringThe name of the extended location.
typerequired - stringThe type of the extended location.
skuoptionalnameoptional - stringName of a public IP address SKU.
tieroptional - stringTier of a public IP address SKU.
propertiesoptionalpublicIPAllocationMethodrequired - stringThe public IP address allocation method.
publicIPAddressVersionoptional - stringThe public IP address version.
dnsSettingsoptionaldomainNameLabelrequired - stringThe domain name label. The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system.
fqdnoptional - stringThe Fully Qualified Domain Name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone.
reverseFqdnoptional - stringThe reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN.
ddosSettingsoptionalddosCustomPolicyoptionalidrequired - stringResource ID.
protectionCoverageoptional - stringThe DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized.
protectedIPoptional - booleanEnables DDoS protection on the public IP.
ipTagsoptional arrayipTagTypeoptional - stringThe IP tag type. Example: FirstPartyUsage.
tagoptional - stringThe value of the IP tag associated with the public IP. Example: SQL.
ipAddressoptional - stringThe IP address associated with the public IP address resource.
publicIPPrefixoptionalidrequired - stringResource ID.
idleTimeoutInMinutesoptional - integerThe idle timeout of the public IP address.
zonesoptional - arrayA list of availability zones denoting the IP allocated for the resource needs to come from.
Frequently asked questions
What is Azure Network IP?
Azure Network IP 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 IP?
For Terraform, the aztfmod/terraform-azurerm-caf, pkhuntia/aztfmod and anmoltoppo/Terraform source code examples are useful. See the Terraform Example section for further details.