101-front-door-classic patch (#170)

* fix example
This commit is contained in:
Dingjia Chen 2023-02-21 00:28:55 -06:00 committed by GitHub
parent 0ba1d6ae57
commit ef09110e94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 19 deletions

View File

@ -1,5 +1,5 @@
locals { locals {
front_door_name = "afd-${lower(random_id.front_door_name.hex)}" front_door_name = "${random_pet.prefix.id}-afd"
front_door_frontend_endpoint_name = "frontEndEndpoint" front_door_frontend_endpoint_name = "frontEndEndpoint"
front_door_load_balancing_settings_name = "loadBalancingSettings" front_door_load_balancing_settings_name = "loadBalancingSettings"
front_door_health_probe_settings_name = "healthProbeSettings" front_door_health_probe_settings_name = "healthProbeSettings"
@ -7,9 +7,9 @@ locals {
front_door_backend_pool_name = "backendPool" front_door_backend_pool_name = "backendPool"
} }
resource "azurerm_frontdoor" "my_front_door" { resource "azurerm_frontdoor" "main" {
name = local.front_door_name name = local.front_door_name
resource_group_name = azurerm_resource_group.my_resource_group.name resource_group_name = azurerm_resource_group.rg.name
frontend_endpoint { frontend_endpoint {
name = local.front_door_frontend_endpoint_name name = local.front_door_frontend_endpoint_name
@ -45,6 +45,11 @@ resource "azurerm_frontdoor" "my_front_door" {
health_probe_name = local.front_door_health_probe_settings_name health_probe_name = local.front_door_health_probe_settings_name
} }
backend_pool_settings {
backend_pools_send_receive_timeout_seconds = 0
enforce_backend_pools_certificate_name_check = false
}
routing_rule { routing_rule {
name = local.front_door_routing_rule_name name = local.front_door_routing_rule_name
accepted_protocols = ["Http", "Https"] accepted_protocols = ["Http", "Https"]

View File

@ -1,18 +1,17 @@
# Configure the Azure provider # Configure the Azure provider
terraform { terraform {
required_version = ">= 1.0"
required_providers { required_providers {
azurerm = { azurerm = {
source = "hashicorp/azurerm" source = "hashicorp/azurerm"
version = "~> 3.27.0" version = "~> 3.0"
} }
random = { random = {
source = "hashicorp/random" source = "hashicorp/random"
version = "~> 3.4.3" version = "~> 3.0"
} }
} }
required_version = ">= 1.1.0"
} }
provider "azurerm" { provider "azurerm" {

View File

@ -1,8 +1,9 @@
resource "azurerm_resource_group" "my_resource_group" { resource "azurerm_resource_group" "rg" {
name = var.resource_group_name name = "${random_pet.prefix.id}-rg"
location = var.location location = var.location
} }
resource "random_id" "front_door_name" { resource "random_pet" "prefix" {
byte_length = 8 prefix = var.prefix
length = 1
} }

View File

@ -3,11 +3,13 @@ variable "location" {
default = "westus2" default = "westus2"
} }
variable "resource_group_name" { variable "backend_address" {
default = "www.bing.com"
type = string type = string
default = "FrontDoor"
} }
variable "backend_address" { variable "prefix" {
type = string type = string
default = "front-door-classic"
description = "Prefix of the resource name"
} }