Skip to content

azurermTrafficManagerAzureEndpoint

Manages an Azure Endpoint within a Traffic Manager Profile.

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 azurermTrafficManagerProfileExample =
  new azurerm.trafficManagerProfile.TrafficManagerProfile(this, "example_1", {
    dns_config: [
      {
        relative_name: "example-profile",
        ttl: 100,
      },
    ],
    monitor_config: [
      {
        interval_in_seconds: 30,
        path: "/",
        port: 80,
        protocol: "HTTP",
        timeout_in_seconds: 9,
        tolerated_number_of_failures: 3,
      },
    ],
    name: "example-profile",
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      environment: "Production",
    },
    traffic_routing_method: "Weighted",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermTrafficManagerProfileExample.overrideLogicalId("example");
const azurermPublicIpExample = new azurerm.publicIp.PublicIp(
  this,
  "example_2",
  {
    allocation_method: "Static",
    domain_name_label: "example-public-ip",
    location: azurermResourceGroupExample.location,
    name: "example-public-ip",
    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.*/
azurermPublicIpExample.overrideLogicalId("example");
const azurermTrafficManagerAzureEndpointExample =
  new azurerm.trafficManagerAzureEndpoint.TrafficManagerAzureEndpoint(
    this,
    "example_3",
    {
      name: "example-endpoint",
      profile_id: azurermTrafficManagerProfileExample.id,
      target_resource_id: azurermPublicIpExample.id,
      weight: 100,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermTrafficManagerAzureEndpointExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the Azure Endpoint. Changing this forces a new resource to be created.

  • profileId - (Required) The ID of the Traffic Manager Profile that this Azure Endpoint should be created within. Changing this forces a new resource to be created.

  • targetResourceId - (Required) The ID of the Azure Resource which should be used as a target.

  • weight - (Optional) Specifies how much traffic should be distributed to this endpoint, this must be specified for Profiles using the Weighted traffic routing method. Valid values are between 1 and 1000.


  • customHeader - (Optional) One or more customHeader blocks as defined below.

  • enabled - (Optional) Is the endpoint enabled? Defaults to true.

  • geoMappings - (Optional) A list of Geographic Regions used to distribute traffic, such as world, uk or de. The same location can't be specified in two endpoints. See the Geographic Hierarchies documentation for more information.

  • priority - (Optional) Specifies the priority of this Endpoint, this must be specified for Profiles using the priority traffic routing method. Supports values between 1 and 1000, with no Endpoints sharing the same value. If omitted the value will be computed in order of creation.

  • subnet - (Optional) One or more subnet blocks as defined below. Changing this forces a new resource to be created.


A customHeader block supports the following:

  • name - (Required) The name of the custom header.

  • value - (Required) The value of custom header. Applicable for HTTP and HTTPS protocol.


A subnet block supports the following:

  • first - (Required) The first IP Address in this subnet.

  • last - (Optional) The last IP Address in this subnet.

  • scope - (Optional) The block size (number of leading bits in the subnet mask).

Attributes Reference

The following attributes are exported:

  • id - The ID of the Azure Endpoint.

Timeouts

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

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

Import

Azure Endpoints can be imported using the resourceId, e.g.

terraform import azurerm_traffic_manager_azure_endpoint.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.Network/trafficManagerProfiles/example-profile/AzureEndpoints/example-endpoint