@@ -11,9 +11,11 @@ resource "azurerm_user_assigned_identity" "example" {
1111
1212module "application-gateway" {
1313 source = " kumarvna/application-gateway/azurerm"
14- version = " 1.0 .0"
14+ version = " 1.1 .0"
1515
16- # Resource Group and location, VNet and Subnet detials (Required)
16+ # By default, this module will not create a resource group and expect to provide
17+ # a existing RG name to use an existing resource group. Location will be same as existing RG.
18+ # set the argument to `create_resource_group = true` to create new resrouce.
1719 resource_group_name = " rg-shared-westeurope-01"
1820 location = " westeurope"
1921 virtual_network_name = " vnet-shared-hub-westeurope-001"
@@ -23,9 +25,13 @@ module "application-gateway" {
2325 # SKU requires `name`, `tier` to use for this Application Gateway
2426 # `Capacity` property is optional if `autoscale_configuration` is set
2527 sku = {
26- name = " Standard_v2"
27- tier = " Standard_v2"
28- capacity = 1
28+ name = " Standard_v2"
29+ tier = " Standard_v2"
30+ }
31+
32+ autoscale_configuration = {
33+ min_capacity = 1
34+ max_capacity = 15
2935 }
3036
3137 # A backend pool routes request to backend servers, which serve the request.
@@ -44,14 +50,15 @@ module "application-gateway" {
4450 # An application gateway routes traffic to the backend servers using the port, protocol, and other settings
4551 # The port and protocol used to check traffic is encrypted between the application gateway and backend servers
4652 # List of backend HTTP settings can be added here.
53+ # `probe_name` argument is required if you are defing health probes.
4754 backend_http_settings = [
4855 {
4956 name = " appgw-testgateway-westeurope-be-http-set1"
5057 cookie_based_affinity = " Disabled"
5158 path = " /"
5259 enable_https = true
5360 request_timeout = 30
54- probe_name = " appgw-testgateway-westeurope-probe1"
61+ probe_name = " appgw-testgateway-westeurope-probe1" # Remove this if `health_probes` object is not defined.
5562 connection_draining = {
5663 enable_connection_draining = true
5764 drain_timeout_sec = 300
@@ -78,16 +85,6 @@ module "application-gateway" {
7885 name = " appgw-testgateway-westeurope-be-htln01"
7986 ssl_certificate_name = " appgw-testgateway-westeurope-ssl01"
8087 host_name = null
81- custom_error_configuration = [
82- {
83- custom_error_page_url = " https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_403_page.html"
84- status_code = " HttpStatus403"
85- },
86- {
87- custom_error_page_url = " https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_502_page.html"
88- status_code = " HttpStatus502"
89- }
90- ]
9188 }
9289 ]
9390
@@ -107,15 +104,6 @@ module "application-gateway" {
107104 }
108105 ]
109106
110- # Application Gateway TLS policy. If not specified, Defaults to `AppGwSslPolicy20150501`
111- # Application Gateway has three predefined security policies to get the appropriate level of security.
112- # `AppGwSslPolicy20150501` - MinProtocolVersion(TLSv1_0), `AppGwSslPolicy20170401` - MinProtocolVersion(TLSv1_1)
113- # `AppGwSslPolicy20170401S` - MinProtocolVersion(TLSv1_2)
114- ssl_policy = {
115- policy_type = " Predefined"
116- policy_name = " AppGwSslPolicy20170401S"
117- }
118-
119107 # TLS termination (previously known as Secure Sockets Layer (SSL) Offloading)
120108 # The certificate on the listener requires the entire certificate chain (PFX certificate) to be uploaded to establish the chain of trust.
121109 # Authentication and trusted root certificate setup are not required for trusted Azure services such as Azure App Service.
@@ -125,49 +113,6 @@ module "application-gateway" {
125113 password = " P@$$w0rd123"
126114 }]
127115
128- # Add custom error pages instead of displaying default error pages when a request can't reach the backend
129- # Custom error pages can be defined at the global level and the listener level:
130- # `Global level` - the error page applies to traffic for all the web applications deployed on that application gateway.
131- # `Listener level` - the error page is applied to traffic received on that listener.
132- # `Both` - the custom error page defined at the listener level overrides the one set at global level.
133- custom_error_configuration = [
134- {
135- custom_error_page_url = " https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_403_page.html"
136- status_code = " HttpStatus403"
137- },
138- {
139- custom_error_page_url = " https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_502_page.html"
140- status_code = " HttpStatus502"
141- }
142- ]
143-
144- # URL path-based redirection allows to route traffic to back-end server pools based on URL Paths of the request.
145- # For both the v1 and v2 SKUs, rules are processed in the order they are listed in the portal. If a basic listener is
146- # listed first and matches an incoming request, it gets processed by that listener. However, it is highly recommended
147- # to configure multi-site listeners first prior to configuring a basic listener. This ensures that traffic gets routed
148- # to the right back end.
149- url_path_maps = [
150- {
151- name = " testgateway-url-path"
152- default_backend_address_pool_name = " appgw-testgateway-westeurope-bapool01"
153- default_backend_http_settings_name = " appgw-testgateway-westeurope-be-http-set1"
154- path_rules = [
155- {
156- name = " api"
157- paths = [" /api/*" ]
158- backend_address_pool_name = " appgw-testgateway-westeurope-bapool01"
159- backend_http_settings_name = " appgw-testgateway-westeurope-be-http-set1"
160- },
161- {
162- name = " videos"
163- paths = [" /videos/*" ]
164- backend_address_pool_name = " appgw-testgateway-westeurope-bapool02"
165- backend_http_settings_name = " appgw-testgateway-westeurope-be-http-set2"
166- }
167- ]
168- }
169- ]
170-
171116 # By default, an application gateway monitors the health of all resources in its backend pool and automatically removes unhealthy ones.
172117 # It then monitors unhealthy instances and adds them back to the healthy backend pool when they become available and respond to health probes.
173118 # must allow incoming Internet traffic on TCP ports 65503-65534 for the Application Gateway v1 SKU, and TCP ports 65200-65535
@@ -201,4 +146,3 @@ module "application-gateway" {
201146 ServiceClass = " Gold"
202147 }
203148}
204-
0 commit comments