File tree 4 files changed +34
-5
lines changed
4 files changed +34
-5
lines changed Original file line number Diff line number Diff line change
1
+ 1.3.0
Original file line number Diff line number Diff line change @@ -174,10 +174,29 @@ resource "google_compute_url_map" "https_redirect" {
174
174
project = var. project
175
175
count = var. https_redirect ? 1 : 0
176
176
name = " ${ var . name } -https-redirect"
177
- default_url_redirect {
178
- https_redirect = true
179
- redirect_response_code = " MOVED_PERMANENTLY_DEFAULT"
180
- strip_query = false
177
+
178
+ host_rule {
179
+ hosts = length (var. https_redirect_domains ) > 0 ? var. https_redirect_domains : [" *" ]
180
+ path_matcher = " https-redirect-matcher"
181
+ }
182
+ path_matcher {
183
+ name = " https-redirect-matcher"
184
+ default_url_redirect {
185
+ https_redirect = true
186
+ redirect_response_code = " MOVED_PERMANENTLY_DEFAULT"
187
+ strip_query = false
188
+ }
189
+ }
190
+ default_route_action {
191
+ weighted_backend_services {
192
+ backend_service = google_compute_backend_service. default [keys (var. backends )[0 ]]. self_link
193
+ }
194
+ fault_injection_policy {
195
+ abort {
196
+ http_status = 404
197
+ percentage = 100
198
+ }
199
+ }
181
200
}
182
201
}
183
202
Original file line number Diff line number Diff line change @@ -275,6 +275,15 @@ variable "https_redirect" {
275
275
default = false
276
276
}
277
277
278
+ variable "https_redirect_domains" {
279
+ type = list (string )
280
+ default = []
281
+ validation {
282
+ condition = var. https_redirect_domains == [] || ! (length (var. https_redirect_domains ) == 1 && var. https_redirect_domains [0 ] == " " )
283
+ error_message = " The variable \" https_redirect_domains\" must not contain an empty string. Use an empty list ([]) if no domains are provided."
284
+ }
285
+ }
286
+
278
287
variable "random_certificate_suffix" {
279
288
description = " Bool to enable/disable random certificate name generation. Set and keep this to true if you need to change the SSL cert."
280
289
type = bool
Original file line number Diff line number Diff line change 15
15
*/
16
16
17
17
terraform {
18
- required_version = " >= 1.3 "
18
+ required_version = " >= 1.2.9 "
19
19
required_providers {
20
20
21
21
google = {
You can’t perform that action at this time.
0 commit comments