Skip to content

azurermRouteMap

Manages a Route Map.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermRouteMapExample = new azurerm.routeMap.RouteMap(
  this,
  "example_1",
  {
    name: "example-rm",
    rule: [
      {
        action: [
          {
            parameter: [
              {
                as_path: ["22334"],
              },
            ],
            type: "Add",
          },
        ],
        match_criterion: [
          {
            match_condition: "Contains",
            route_prefix: ["10.0.0.0/8"],
          },
        ],
        name: "rule1",
        next_step_if_matched: "Continue",
      },
    ],
    virtual_hub_id: "${azurerm_virtual_hub.example.id}",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRouteMapExample.overrideLogicalId("example");
const azurermVirtualWanExample = new azurerm.virtualWan.VirtualWan(
  this,
  "example_2",
  {
    location: azurermResourceGroupExample.location,
    name: "example-vwan",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualWanExample.overrideLogicalId("example");
new azurerm.virtualHub.VirtualHub(this, "test", {
  address_prefix: "10.0.1.0/24",
  location: azurermResourceGroupExample.location,
  name: "example-vhub",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_wan_id: azurermVirtualWanExample.id,
});

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Route Map. Changing this forces a new resource to be created.

  • virtualHubId - (Required) The resource ID of the Virtual Hub. Changing this forces a new resource to be created.

  • rule - (Optional) A rule block as defined below.


A rule block supports the following:

  • name - (Required) The unique name for the rule.

  • action - (Optional) An action block as defined below.

  • matchCriterion - (Optional) A matchCriterion block as defined below.

  • nextStepIfMatched - (Optional) The next step after the rule is evaluated. Possible values are continue, terminate and unknown. Defaults to unknown.


An action block supports the following:

  • parameter - (Required) A parameter block as defined below.

  • type - (Required) The type of the action to be taken. Possible values are add, drop, remove, replace and unknown.


A parameter block supports the following:

  • asPath - (Optional) A list of AS paths.

  • community - (Optional) A list of BGP communities.

  • routePrefix - (Optional) A list of route prefixes.


A matchCriterion block supports the following:

  • matchCondition - (Required) The match condition to apply the rule of the Route Map. Possible values are contains, equals, notContains, notEquals and unknown.

  • asPath - (Optional) A list of AS paths which this criterion matches.

  • community - (Optional) A list of BGP communities which this criterion matches.

  • routePrefix - (Optional) A list of route prefixes which this criterion matches.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Route Map.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Route Map.
  • read - (Defaults to 5 minutes) Used when retrieving the Route Map.
  • update - (Defaults to 30 minutes) Used when updating the Route Map.
  • delete - (Defaults to 30 minutes) Used when deleting the Route Map.

Import

Route Maps can be imported using the resourceId, e.g.

terraform import azurerm_route_map.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1