Skip to content

Commit 3c8bd76

Browse files
authored
sample
1 parent 7195038 commit 3c8bd76

File tree

1 file changed

+76
-0
lines changed
  • 3_networking/application-gateway

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Azure Application Gateway minimal configuration
2+
3+
resource "azurerm_resource_group" "agw" {
4+
name = var.resource_group_name
5+
location = var.location
6+
}
7+
8+
resource "azurerm_virtual_network" "vnet" {
9+
name = var.vnet_name
10+
location = azurerm_resource_group.agw.location
11+
resource_group_name = azurerm_resource_group.agw.name
12+
address_space = var.vnet_address_space
13+
}
14+
15+
resource "azurerm_subnet" "subnet" {
16+
name = var.subnet_name
17+
resource_group_name = azurerm_resource_group.agw.name
18+
virtual_network_name = azurerm_virtual_network.vnet.name
19+
address_prefixes = var.subnet_address_prefixes
20+
}
21+
22+
resource "azurerm_public_ip" "agw" {
23+
name = var.public_ip_name
24+
location = azurerm_resource_group.agw.location
25+
resource_group_name = azurerm_resource_group.agw.name
26+
allocation_method = "Static"
27+
sku = "Standard"
28+
}
29+
30+
resource "azurerm_application_gateway" "agw" {
31+
name = var.app_gateway_name
32+
location = azurerm_resource_group.agw.location
33+
resource_group_name = azurerm_resource_group.agw.name
34+
sku {
35+
name = "Standard_v2"
36+
tier = "Standard_v2"
37+
capacity = 2
38+
}
39+
gateway_ip_configuration {
40+
name = "appGatewayIpConfig"
41+
subnet_id = azurerm_subnet.subnet.id
42+
}
43+
frontend_port {
44+
name = "frontendPort"
45+
port = 80
46+
}
47+
frontend_ip_configuration {
48+
name = "frontendIpConfig"
49+
public_ip_address_id = azurerm_public_ip.agw.id
50+
}
51+
backend_address_pool {
52+
name = "backendPool"
53+
}
54+
backend_http_settings {
55+
name = "httpSettings"
56+
cookie_based_affinity = "Disabled"
57+
port = 80
58+
protocol = "Http"
59+
}
60+
http_listener {
61+
name = "httpListener"
62+
frontend_ip_configuration_name = "frontendIpConfig"
63+
frontend_port_name = "frontendPort"
64+
protocol = "Http"
65+
}
66+
67+
request_routing_rule {
68+
name = "rule1"
69+
rule_type = "Basic"
70+
http_listener_name = "httpListener"
71+
backend_address_pool_name = "backendPool"
72+
backend_http_settings_name = "httpSettings"
73+
priority = 320 # Add a priority value (1-20000)
74+
}
75+
76+
}

0 commit comments

Comments
 (0)