User Story 145880 (#243)
* Updating Front Door Standard/Premium code sample
This commit is contained in:
76
quickstart/101-front-door-standard-premium/main.tf
Normal file
76
quickstart/101-front-door-standard-premium/main.tf
Normal file
@ -0,0 +1,76 @@
|
||||
resource "random_pet" "rg-name" {
|
||||
prefix = var.resource_group_name_prefix
|
||||
}
|
||||
|
||||
resource "azurerm_resource_group" "rg" {
|
||||
name = random_pet.rg-name.id
|
||||
location = var.resource_group_location
|
||||
}
|
||||
|
||||
resource "random_id" "front_door_endpoint_name" {
|
||||
byte_length = 8
|
||||
}
|
||||
|
||||
locals {
|
||||
front_door_profile_name = "MyFrontDoor"
|
||||
front_door_endpoint_name = "afd-${lower(random_id.front_door_endpoint_name.hex)}"
|
||||
front_door_origin_group_name = "MyOriginGroup"
|
||||
front_door_origin_name = "MyAppServiceOrigin"
|
||||
front_door_route_name = "MyRoute"
|
||||
}
|
||||
|
||||
resource "azurerm_cdn_frontdoor_profile" "my_front_door" {
|
||||
name = local.front_door_profile_name
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
sku_name = var.front_door_sku_name
|
||||
}
|
||||
|
||||
resource "azurerm_cdn_frontdoor_endpoint" "my_endpoint" {
|
||||
name = local.front_door_endpoint_name
|
||||
cdn_frontdoor_profile_id = azurerm_cdn_frontdoor_profile.my_front_door.id
|
||||
}
|
||||
|
||||
resource "azurerm_cdn_frontdoor_origin_group" "my_origin_group" {
|
||||
name = local.front_door_origin_group_name
|
||||
cdn_frontdoor_profile_id = azurerm_cdn_frontdoor_profile.my_front_door.id
|
||||
session_affinity_enabled = true
|
||||
|
||||
load_balancing {
|
||||
sample_size = 4
|
||||
successful_samples_required = 3
|
||||
}
|
||||
|
||||
health_probe {
|
||||
path = "/"
|
||||
request_type = "HEAD"
|
||||
protocol = "Https"
|
||||
interval_in_seconds = 100
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_cdn_frontdoor_origin" "my_app_service_origin" {
|
||||
name = local.front_door_origin_name
|
||||
cdn_frontdoor_origin_group_id = azurerm_cdn_frontdoor_origin_group.my_origin_group.id
|
||||
|
||||
enabled = true
|
||||
host_name = azurerm_windows_web_app.app.default_hostname
|
||||
http_port = 80
|
||||
https_port = 443
|
||||
origin_host_header = azurerm_windows_web_app.app.default_hostname
|
||||
priority = 1
|
||||
weight = 1000
|
||||
certificate_name_check_enabled = true
|
||||
}
|
||||
|
||||
resource "azurerm_cdn_frontdoor_route" "my_route" {
|
||||
name = local.front_door_route_name
|
||||
cdn_frontdoor_endpoint_id = azurerm_cdn_frontdoor_endpoint.my_endpoint.id
|
||||
cdn_frontdoor_origin_group_id = azurerm_cdn_frontdoor_origin_group.my_origin_group.id
|
||||
cdn_frontdoor_origin_ids = [azurerm_cdn_frontdoor_origin.my_app_service_origin.id]
|
||||
|
||||
supported_protocols = ["Http", "Https"]
|
||||
patterns_to_match = ["/*"]
|
||||
forwarding_protocol = "HttpsOnly"
|
||||
link_to_default_domain = true
|
||||
https_redirect_enabled = true
|
||||
}
|
Reference in New Issue
Block a user