Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTPS frontend with SNEG example #1112

Merged
merged 6 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions modules/net-glb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,46 @@ module "glb-0" {
# tftest modules=1 resources=5
```

Serverless NEGs don't use the port name but it should be set to `http`. An HTTPS frontend requires the protocol to be set to `HTTPS`, and the port name field will infer this value if omitted so you need to set it explicitly:

```hcl
module "glb-0" {
source = "./fabric/modules/net-glb"
project_id = "myprj"
name = "glb-test-0"
backend_service_configs = {
default = {
backends = [
{ backend = "neg-0" }
]
health_checks = []
port_name = "http"
}
}
# with a single serverless NEG the implied default health check is not needed
health_check_configs = {}
neg_configs = {
neg-0 = {
cloudrun = {
region = "europe-west8"
target_service = {
name = "hello"
}
}
}
}
protocol = "HTTPS"
ssl_certificates = {
managed_configs = {
default = {
domains = ["glb-test-0.example.org"]
}
}
}
}
# tftest modules=1 resources=6 inventory=https-sneg.yaml
```

### URL Map

The module exposes the full URL map resource configuration, with some minor changes to the interface to decrease verbosity, and support for aliasing backend services via keys.
Expand Down
35 changes: 35 additions & 0 deletions tests/modules/net_glb/examples/https-sneg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.

values:
module.glb-0.google_compute_backend_service.default["default"]:
port_name: http
protocol: HTTPS
module.glb-0.google_compute_global_forwarding_rule.default:
load_balancing_scheme: EXTERNAL
port_range: '443'
module.glb-0.google_compute_region_network_endpoint_group.serverless["neg-0"]:
cloud_run:
- service: hello
tag: null
url_mask: null

counts:
google_compute_backend_service: 1
google_compute_global_forwarding_rule: 1
google_compute_managed_ssl_certificate: 1
google_compute_region_network_endpoint_group: 1
google_compute_target_https_proxy: 1
google_compute_url_map: 1