Skip to content

Commit

Permalink
Fix urlmap in ILB L7 module (#1299)
Browse files Browse the repository at this point in the history
* port tests to new format

* add test to catch error and fix urlmap

* boilerplate

* boilerplate
  • Loading branch information
ludoo authored and lcaggio committed May 5, 2023
1 parent ff0a460 commit 43cbafd
Show file tree
Hide file tree
Showing 30 changed files with 465 additions and 357 deletions.
4 changes: 2 additions & 2 deletions modules/net-ilb-l7/urlmap.tf
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,9 @@ resource "google_compute_region_url_map" "default" {
}
dynamic "url_redirect" {
for_each = (
route_rules.value.default_url_redirect == null
route_rules.value.url_redirect == null
? []
: [route_rules.value.default_url_redirect]
: [route_rules.value.url_redirect]
)
content {
host_redirect = url_redirect.value.host
Expand Down
23 changes: 23 additions & 0 deletions tests/modules/net_ilb_l7/common.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

project_id = "my-project"
name = "ilb-l7-test"
region = "europe-west1"
vpc_config = {
network = "projects/my-project/global/networks/default"
subnetwork = "projects/my-project/regions/europe-west1/subnetworks/default"
}
23 changes: 23 additions & 0 deletions tests/modules/net_ilb_l7/defaults.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
}]
}
}
20 changes: 20 additions & 0 deletions tests/modules/net_ilb_l7/defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

counts:
google_compute_forwarding_rule: 1
google_compute_health_check: 1
google_compute_region_backend_service: 1
google_compute_region_target_http_proxy: 1
google_compute_region_url_map: 1
38 changes: 0 additions & 38 deletions tests/modules/net_ilb_l7/fixture/main.tf

This file was deleted.

7 changes: 0 additions & 7 deletions tests/modules/net_ilb_l7/fixture/test.defaults.tfvars

This file was deleted.

16 changes: 0 additions & 16 deletions tests/modules/net_ilb_l7/fixture/test.groups.tfvars

This file was deleted.

16 changes: 0 additions & 16 deletions tests/modules/net_ilb_l7/fixture/test.health-checks-custom.tfvars

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions tests/modules/net_ilb_l7/fixture/test.https.tfvars

This file was deleted.

21 changes: 0 additions & 21 deletions tests/modules/net_ilb_l7/fixture/test.negs.tfvars

This file was deleted.

9 changes: 0 additions & 9 deletions tests/modules/net_ilb_l7/fixture/test.ssl.tfvars

This file was deleted.

28 changes: 0 additions & 28 deletions tests/modules/net_ilb_l7/fixture/test.urlmaps.tfvars

This file was deleted.

84 changes: 0 additions & 84 deletions tests/modules/net_ilb_l7/fixture/variables.tf

This file was deleted.

32 changes: 32 additions & 0 deletions tests/modules/net_ilb_l7/groups.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

backend_service_configs = {
default = {
backends = [{
group = "custom"
}]
}
}
group_configs = {
custom = {
zone = "europe-west1-b"
instances = [
"projects/myprj/zones/europe-west1-b/instances/vm-a"
]
named_ports = { http = 80 }
}
}
21 changes: 21 additions & 0 deletions tests/modules/net_ilb_l7/groups.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

counts:
google_compute_forwarding_rule: 1
google_compute_health_check: 1
google_compute_instance_group: 1
google_compute_region_backend_service: 1
google_compute_region_target_http_proxy: 1
google_compute_region_url_map: 1

0 comments on commit 43cbafd

Please sign in to comment.