Azure Network DDOS Protection Plan

This page shows how to write Terraform and Azure Resource Manager for Network DDOS Protection Plan and write them securely.

azurerm_network_ddos_protection_plan (Terraform)

The DDOS Protection Plan in Network can be configured in Terraform with the resource name azurerm_network_ddos_protection_plan. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "azurerm_network_ddos_protection_plan" "module" {
  name                = var.ddos_plan_name
  location            = var.ddos_plan_location
  resource_group_name = var.rg_name

  tags = var.ddos_plan_tags
vnet.tf#L83
resource "azurerm_network_ddos_protection_plan" "ddos_protection_geewa_a" {
  name                = var.ddos_protection_geewa_a
  location            = azurerm_resource_group.rg_geewa_name_a.location
  resource_group_name = azurerm_resource_group.rg_geewa_name_a.name
  depends_on = [azurerm_resource_group.rg_geewa_name_a]
}
az_ddos.tf#L1
resource "azurerm_network_ddos_protection_plan" "ddos" {
  name                = var.vpc_cnf["ddos_plan_name"]
  location            = var.location
  resource_group_name = azurerm_resource_group.bozo.name
}
main.tf#L1
resource "azurerm_network_ddos_protection_plan" "ddos_plan" {
  name     = join( var.ddos_plan_name_separator, var.ddos_plan_name_strings)
  location = var.ddos_plan_location
  resource_group_name = var.resource_group_name

  tags = var.ddos_plan_tags != "" ? var.ddos_plan_tags : null
ddos.tf#L3
resource "azurerm_network_ddos_protection_plan" "ddos_protection_plan" {
  count = var.enable_ddos_standard ? 1 : 0

  name                = var.name
  location            = var.location
  resource_group_name = var.rg
terraform%20vnet.tf#L12
resource "azurerm_network_ddos_protection_plan" "example" {
  name                = "ddospplan1"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

main.tf#L14
resource "azurerm_network_ddos_protection_plan" "ddos" {
  name                = "ddospplan1"
  location            = var.location
  resource_group_name = azurerm_resource_group.rg.name
}

network.tf#L20
resource "azurerm_network_ddos_protection_plan" "example" {
  name                = "ddospplan2"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

ddos.tf#L3
resource "azurerm_network_ddos_protection_plan" "ddos_protection_plan" {
  count = var.enable_ddos_standard ? 1 : 0

  name                = var.name
  location            = var.location
  resource_group_name = var.rg
main.tf#L9
resource "azurerm_network_ddos_protection_plan" "ddospplan" {
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  name                = var.ddos_protection_plan_name
  tags                = merge(var.tags, var.custom_tags)
}

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an AzureNetwork DDoS Protection Plan. -> NOTE Azure only allows one DDoS Protection Plan per region.

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.

risk-label

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.

risk-label

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.

risk-label

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.

Review your Azure Network settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Microsoft.Network/ddosProtectionPlans (Azure Resource Manager)

The ddosProtectionPlans in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/ddosProtectionPlans. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

azure.com_network-ddosProtectionPlan_2018-08-01.json#L111
                      "type": "Microsoft.Network/ddosProtectionPlans"
                    },
                    {
                      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/plan2",
                      "location": "westus",
                      "name": "plan2",
policy_definition_es_deploy_ddosprotection.json#L63
          "type": "Microsoft.Network/ddosProtectionPlans",
          "deploymentScope": "Subscription",
          "existenceScope": "ResourceGroup",
          "resourceGroupName": "[parameters('rgName')]",
          "name": "[parameters('ddosName')]",
          "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L50
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L50
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L62
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L50
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L50
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L62
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L50
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [
Microsoft.Authorization_policyDefinitions-Deploy-DDoSProtection.parameters.json#L50
                "type": "Microsoft.Network/ddosProtectionPlans",
                "deploymentScope": "Subscription",
                "existenceScope": "ResourceGroup",
                "resourceGroupName": "[parameters('rgName')]",
                "name": "[parameters('ddosName')]",
                "roleDefinitionIds": [

Parameters

  • name required - string
  • type required - string
  • apiVersion required - string
  • location optional - string

    Resource location.

  • tags optional - string

    Resource tags.

  • properties required

    Frequently asked questions

    What is Azure Network DDOS Protection Plan?

    Azure Network DDOS Protection Plan 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 DDOS Protection Plan?

    For Terraform, the jessewilk/terraform, Ansermuhammad/geewa-terraform-azure-infrastructure and kernell128/terraform_cloud source code examples are useful. See the Terraform Example section for further details.

    For Azure Resource Manager, the Pudding124/SwaggerStructure, tschwarz01/tf-caf-data-management-zone and bayro1/Enterprise-Scale source code examples are useful. See the Azure Resource Manager Example section for further details.