Skip to content

Commit a81c1fc

Browse files
authored
Merge pull request #4 from kumarvna/develop
bug fixes and updates to module
2 parents b8e52e5 + a1fe7cf commit a81c1fc

File tree

14 files changed

+1398
-286
lines changed

14 files changed

+1398
-286
lines changed

README.md

Lines changed: 402 additions & 59 deletions
Large diffs are not rendered by default.

examples/complete/README.md renamed to examples/application_gateway_with_ssl/README.md

Lines changed: 13 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ resource "azurerm_user_assigned_identity" "example" {
2222
2323
module "application-gateway" {
2424
source = "kumarvna/application-gateway/azurerm"
25-
version = "1.0.0"
25+
version = "1.1.0"
2626
27-
# Resource Group and location, VNet and Subnet detials (Required)
27+
# By default, this module will not create a resource group and expect to provide
28+
# a existing RG name to use an existing resource group. Location will be same as existing RG.
29+
# set the argument to `create_resource_group = true` to create new resrouce.
2830
resource_group_name = "rg-shared-westeurope-01"
2931
location = "westeurope"
3032
virtual_network_name = "vnet-shared-hub-westeurope-001"
@@ -34,9 +36,13 @@ module "application-gateway" {
3436
# SKU requires `name`, `tier` to use for this Application Gateway
3537
# `Capacity` property is optional if `autoscale_configuration` is set
3638
sku = {
37-
name = "Standard_v2"
38-
tier = "Standard_v2"
39-
capacity = 1
39+
name = "Standard_v2"
40+
tier = "Standard_v2"
41+
}
42+
43+
autoscale_configuration = {
44+
min_capacity = 1
45+
max_capacity = 15
4046
}
4147
4248
# A backend pool routes request to backend servers, which serve the request.
@@ -55,14 +61,15 @@ module "application-gateway" {
5561
# An application gateway routes traffic to the backend servers using the port, protocol, and other settings
5662
# The port and protocol used to check traffic is encrypted between the application gateway and backend servers
5763
# List of backend HTTP settings can be added here.
64+
# `probe_name` argument is required if you are defing health probes.
5865
backend_http_settings = [
5966
{
6067
name = "appgw-testgateway-westeurope-be-http-set1"
6168
cookie_based_affinity = "Disabled"
6269
path = "/"
6370
enable_https = true
6471
request_timeout = 30
65-
probe_name = "appgw-testgateway-westeurope-probe1"
72+
probe_name = "appgw-testgateway-westeurope-probe1" # Remove this if `health_probes` object is not defined.
6673
connection_draining = {
6774
enable_connection_draining = true
6875
drain_timeout_sec = 300
@@ -89,16 +96,6 @@ module "application-gateway" {
8996
name = "appgw-testgateway-westeurope-be-htln01"
9097
ssl_certificate_name = "appgw-testgateway-westeurope-ssl01"
9198
host_name = null
92-
custom_error_configuration = [
93-
{
94-
custom_error_page_url = "https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_403_page.html"
95-
status_code = "HttpStatus403"
96-
},
97-
{
98-
custom_error_page_url = "https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_502_page.html"
99-
status_code = "HttpStatus502"
100-
}
101-
]
10299
}
103100
]
104101
@@ -118,15 +115,6 @@ module "application-gateway" {
118115
}
119116
]
120117
121-
# Application Gateway TLS policy. If not specified, Defaults to `AppGwSslPolicy20150501`
122-
# Application Gateway has three predefined security policies to get the appropriate level of security.
123-
# `AppGwSslPolicy20150501` - MinProtocolVersion(TLSv1_0), `AppGwSslPolicy20170401` - MinProtocolVersion(TLSv1_1)
124-
# `AppGwSslPolicy20170401S` - MinProtocolVersion(TLSv1_2)
125-
ssl_policy = {
126-
policy_type = "Predefined"
127-
policy_name = "AppGwSslPolicy20170401S"
128-
}
129-
130118
# TLS termination (previously known as Secure Sockets Layer (SSL) Offloading)
131119
# The certificate on the listener requires the entire certificate chain (PFX certificate) to be uploaded to establish the chain of trust.
132120
# Authentication and trusted root certificate setup are not required for trusted Azure services such as Azure App Service.
@@ -136,49 +124,6 @@ module "application-gateway" {
136124
password = "P@$$w0rd123"
137125
}]
138126
139-
# Add custom error pages instead of displaying default error pages when a request can't reach the backend
140-
# Custom error pages can be defined at the global level and the listener level:
141-
# `Global level` - the error page applies to traffic for all the web applications deployed on that application gateway.
142-
# `Listener level` - the error page is applied to traffic received on that listener.
143-
# `Both` - the custom error page defined at the listener level overrides the one set at global level.
144-
custom_error_configuration = [
145-
{
146-
custom_error_page_url = "https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_403_page.html"
147-
status_code = "HttpStatus403"
148-
},
149-
{
150-
custom_error_page_url = "https://stdiagfortesting.blob.core.windows.net/appgateway/custom_error_502_page.html"
151-
status_code = "HttpStatus502"
152-
}
153-
]
154-
155-
# URL path-based redirection allows to route traffic to back-end server pools based on URL Paths of the request.
156-
# For both the v1 and v2 SKUs, rules are processed in the order they are listed in the portal. If a basic listener is
157-
# listed first and matches an incoming request, it gets processed by that listener. However, it is highly recommended
158-
# to configure multi-site listeners first prior to configuring a basic listener. This ensures that traffic gets routed
159-
# to the right back end.
160-
url_path_maps = [
161-
{
162-
name = "testgateway-url-path"
163-
default_backend_address_pool_name = "appgw-testgateway-westeurope-bapool01"
164-
default_backend_http_settings_name = "appgw-testgateway-westeurope-be-http-set1"
165-
path_rules = [
166-
{
167-
name = "api"
168-
paths = ["/api/*"]
169-
backend_address_pool_name = "appgw-testgateway-westeurope-bapool01"
170-
backend_http_settings_name = "appgw-testgateway-westeurope-be-http-set1"
171-
},
172-
{
173-
name = "videos"
174-
paths = ["/videos/*"]
175-
backend_address_pool_name = "appgw-testgateway-westeurope-bapool02"
176-
backend_http_settings_name = "appgw-testgateway-westeurope-be-http-set2"
177-
}
178-
]
179-
}
180-
]
181-
182127
# By default, an application gateway monitors the health of all resources in its backend pool and automatically removes unhealthy ones.
183128
# It then monitors unhealthy instances and adds them back to the healthy backend pool when they become available and respond to health probes.
184129
# must allow incoming Internet traffic on TCP ports 65503-65534 for the Application Gateway v1 SKU, and TCP ports 65200-65535

examples/complete/main.tf renamed to examples/application_gateway_with_ssl/main.tf

Lines changed: 13 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ resource "azurerm_user_assigned_identity" "example" {
1111

1212
module "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-

examples/complete/output.tf renamed to examples/application_gateway_with_ssl/output.tf

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -128,31 +128,6 @@ output "url_path_map_default_redirect_configuration_id" {
128128
value = module.application-gateway.url_path_map_default_redirect_configuration_id
129129
}
130130

131-
output "url_path_map_path_rule_id" {
132-
description = "The ID of the Path Rule associated with URL Path Map"
133-
value = module.application-gateway.url_path_map_path_rule_id
134-
}
135-
136-
output "url_path_map_path_rule_backend_address_pool_id" {
137-
description = "The ID of the Backend Address Pool used in this Path Rule"
138-
value = module.application-gateway.url_path_map_path_rule_backend_address_pool_id
139-
}
140-
141-
output "url_path_map_path_rule_backend_http_settings_id" {
142-
description = "The ID of the Backend HTTP Settings Collection used in this Path Rule"
143-
value = module.application-gateway.url_path_map_path_rule_backend_http_settings_id
144-
}
145-
146-
output "url_path_map_path_rule_redirect_configuration_id" {
147-
description = "The ID of the Redirect Configuration used in this Path Rule"
148-
value = module.application-gateway.url_path_map_path_rule_redirect_configuration_id
149-
}
150-
151-
output "url_path_map_path_rule_rewrite_rule_set_id" {
152-
description = "The ID of the Rewrite Rule Set used in this Path Rule"
153-
value = module.application-gateway.url_path_map_path_rule_rewrite_rule_set_id
154-
}
155-
156131
output "custom_error_configuration_id" {
157132
description = "The ID of the Custom Error Configuration"
158133
value = module.application-gateway.custom_error_configuration_id

0 commit comments

Comments
 (0)