azurermTrafficManagerProfile
Manages a Traffic Manager Profile to which multiple endpoints can be attached.
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";
import * as random from "./.gen/providers/random";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm, random.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "trafficmanagerProfile",
}
);
const randomIdServer = new random.id.Id(this, "server", {
byte_length: 8,
keepers: [
{
azi_id: 1,
},
],
});
const azurermTrafficManagerProfileExample =
new azurerm.trafficManagerProfile.TrafficManagerProfile(this, "example_2", {
dns_config: [
{
relative_name: randomIdServer.hex,
ttl: 100,
},
],
monitor_config: [
{
interval_in_seconds: 30,
path: "/",
port: 80,
protocol: "HTTP",
timeout_in_seconds: 9,
tolerated_number_of_failures: 3,
},
],
name: randomIdServer.hex,
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");
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the Traffic Manager profile. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group in which to create the Traffic Manager profile. Changing this forces a new resource to be created. -
profileStatus
- (Optional) The status of the profile, can be set to eitherenabled
ordisabled
. Defaults toenabled
. -
trafficRoutingMethod
- (Required) Specifies the algorithm used to route traffic. Possible values aregeographic
,weighted
,performance
,priority
,subnet
andmultiValue
.geographic
- Traffic is routed based on Geographic regions specified in the Endpoint.multiValue
- All healthy Endpoints are returned. MultiValue routing method works only if all the endpoints of type ‘External’ and are specified as IPv4 or IPv6 addresses.performance
- Traffic is routed via the User's closest Endpointpriority
- Traffic is routed to the Endpoint with the lowestpriority
value.subnet
- Traffic is routed based on a mapping of sets of end-user IP address ranges to a specific Endpoint within a Traffic Manager profile.weighted
- Traffic is spread across Endpoints proportional to theirweight
value.
-
trafficViewEnabled
- (Optional) Indicates whether Traffic View is enabled for the Traffic Manager profile. -
dnsConfig
- (Required) This block specifies the DNS configuration of the Profile, it supports the fields documented below. -
monitorConfig
- (Required) This block specifies the Endpoint monitoring configuration for the Profile, it supports the fields documented below. -
maxReturn
- (Optional) The amount of endpoints to return for DNS queries to this Profile. Possible values range from1
to8
.
\~> NOTE: maxReturn
must be set when the trafficRoutingMethod
is multiValue
.
tags
- (Optional) A mapping of tags to assign to the resource.
The dnsConfig
block supports:
-
relativeName
- (Required) The relative domain name, this is combined with the domain name used by Traffic Manager to form the FQDN which is exported as documented below. Changing this forces a new resource to be created. -
ttl
- (Required) The TTL value of the Profile used by Local DNS resolvers and clients.
The monitorConfig
block supports:
-
protocol
- (Required) The protocol used by the monitoring checks, supported values arehttp
,https
andtcp
. -
port
- (Required) The port number used by the monitoring checks. -
path
- (Optional) The path used by the monitoring checks. Required whenprotocol
is set tohttp
orhttps
- cannot be set whenprotocol
is set totcp
. -
expectedStatusCodeRanges
- (Optional) A list of status code ranges in the format of100101
. -
customHeader
- (Optional) One or morecustomHeader
blocks as defined below. -
intervalInSeconds
- (Optional) The interval used to check the endpoint health from a Traffic Manager probing agent. You can specify two values here:30
(normal probing) and10
(fast probing). The default value is30
. -
timeoutInSeconds
- (Optional) The amount of time the Traffic Manager probing agent should wait before considering that check a failure when a health check probe is sent to the endpoint. IfintervalInSeconds
is set to30
, thentimeoutInSeconds
can be between5
and10
. The default value is10
. IfintervalInSeconds
is set to10
, then valid values are between5
and9
andtimeoutInSeconds
is required. -
toleratedNumberOfFailures
- (Optional) The number of failures a Traffic Manager probing agent tolerates before marking that endpoint as unhealthy. Valid values are between0
and9
. The default value is3
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.
Attributes Reference
The following attributes are exported:
-
id
- The ID of the Traffic Manager Profile. -
fqdn
- The FQDN of the created Profile.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Traffic Manager Profile.update
- (Defaults to 30 minutes) Used when updating the Traffic Manager Profile.read
- (Defaults to 5 minutes) Used when retrieving the Traffic Manager Profile.delete
- (Defaults to 30 minutes) Used when deleting the Traffic Manager Profile.
Import
Traffic Manager Profiles can be imported using the resourceId
, e.g.