github.com/swisspost/terratest@v0.0.0-20230214120104-7ec6de2e1ae0/examples/azure/terraform-azure-frontdoor-example/main.tf (about) 1 # --------------------------------------------------------------------------------------------------------------------- 2 # DEPLOY AN AZURE FRONT DOOR 3 # This is an example of how to deploy an Azure Front Door with the minimum resources. 4 # --------------------------------------------------------------------------------------------------------------------- 5 # See test/azure/terraform_azure_frontdoor_example_test.go for how to write automated tests for this code. 6 # --------------------------------------------------------------------------------------------------------------------- 7 8 terraform { 9 required_version = ">=0.14.0" 10 } 11 12 provider "azurerm" { 13 features {} 14 } 15 16 # --------------------------------------------------------------------------------------------------------------------- 17 # DEPLOY A RESOURCE GROUP 18 # --------------------------------------------------------------------------------------------------------------------- 19 20 resource "azurerm_resource_group" "rg" { 21 name = "terratest-frontdoor-rg-${var.postfix}" 22 location = var.location 23 } 24 25 # --------------------------------------------------------------------------------------------------------------------- 26 # DEPLOY FRONT DOOR 27 # --------------------------------------------------------------------------------------------------------------------- 28 29 resource "azurerm_frontdoor" "frontdoor" { 30 name = "terratest-afd-${var.postfix}" 31 resource_group_name = azurerm_resource_group.rg.name 32 33 backend_pool_settings { 34 enforce_backend_pools_certificate_name_check = false 35 } 36 37 routing_rule { 38 name = "terratestRoutingRule1" 39 accepted_protocols = ["Http", "Https"] 40 patterns_to_match = ["/*"] 41 frontend_endpoints = ["terratestEndpoint"] 42 forwarding_configuration { 43 forwarding_protocol = "MatchRequest" 44 backend_pool_name = "terratestBackend" 45 } 46 } 47 48 backend_pool_load_balancing { 49 name = "terratestLoadBalanceSetting" 50 } 51 52 backend_pool_health_probe { 53 name = "terratestHealthProbeSetting" 54 } 55 56 backend_pool { 57 name = "terratestBackend" 58 backend { 59 host_header = var.backend_host 60 address = var.backend_host 61 http_port = 80 62 https_port = 443 63 } 64 65 load_balancing_name = "terratestLoadBalanceSetting" 66 health_probe_name = "terratestHealthProbeSetting" 67 } 68 69 frontend_endpoint { 70 name = "terratestEndpoint" 71 host_name = "terratest-afd-${var.postfix}.azurefd.net" 72 } 73 }