terraform-google-lb-http
terraform-google-lb-http copied to clipboard
Expand url map functionality in serverless_negs
Previously, this module provided the option to either construct a trivial url map which maps everything to a single backend OR pass in a url map. The problem with passing in a url map is that the url map depends on the backend services that are created in the serverless_negs module which makes this approach unworkable.
This work adds the input variable url_map_spec which allows the
user to pass in a map of objects which are keyed on the same set
as the keys of the backends input variable.
This new variable enables the addition of host_rule/path_matcher pairs to the google_compute_url_map block with a list of path_rules for each of these pairs.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Thanks for the PR! 🚀 Unfortunately it looks like some of our CI checks failed. See the Contributing Guide for details.
- ⚠️check_generate_modules
The modules need to be regenerated. Please run
make_build.
Checking submodule's files generation
diff -r '--exclude=.terraform' '--exclude=.kitchen' '--exclude=.git' /workspace/modules/serverless_negs/README.md /tmp/tmp.z6t68OdwHH/workspace/modules/serverless_negs/README.md
96d95
< | url\_map\_spec | Specification for building a URL Map to created backend services. | <pre>map(object({<br> hosts = list(string)<br> default_service = string<br> rules = list(object({<br> paths = list(string)<br> service = string<br> }))<br> }))</pre> | n/a | yes |
diff -r '--exclude=.terraform' '--exclude=.kitchen' '--exclude=.git' /workspace/modules/serverless_negs/main.tf /tmp/tmp.z6t68OdwHH/workspace/modules/serverless_negs/main.tf
152,183c152,155
< project = var.project
< count = var.create_url_map ? 1 : 0
< name = "${var.name}-url-map"
< description = "URL map for ${var.name}."
< default_service = try(
< google_compute_backend_service.default[var.url_map_spec.default_service].self_link,
< google_compute_backend_service.default[keys(var.backends)[0]].self_link
< )
<
< dynamic "host_rule" {
< for_each = { for i, rule in var.url_map_spec.host_rules : i => rule }
< content {
< hosts = host_rule.value.hosts
< path_matcher = host_rule.value.path_matcher
< }
< }
<
< dynamic "path_matcher" {
< for_each = var.url_map_spec.path_matchers
< content {
< name = path_matcher.key
< default_service = google_compute_backend_service.default[path_matcher.value.default_service].self_link
<
< dynamic "path_rule" {
< for_each = { for i, rule in path_matcher.value.rules : i => rule }
< content {
< paths = path_rule.value.paths
< service = google_compute_backend_service.default[path_rule.value.service].self_link
< }
< }
< }
< }
---
> project = var.project
> count = var.create_url_map ? 1 : 0
> name = "${var.name}-url-map"
> default_service = google_compute_backend_service.default[keys(var.backends)[0]].self_link
240a213
>
diff -r '--exclude=.terraform' '--exclude=.kitchen' '--exclude=.git' /workspace/modules/serverless_negs/variables.tf /tmp/tmp.z6t68OdwHH/workspace/modules/serverless_negs/variables.tf
99,116d98
< variable "url_map_spec" {
< type = object({
< default_service = string
< host_rules = list(object({
< hosts = list(string)
< path_matcher = string
< }))
< path_matchers = map(object({
< default_service = string
< rules = list(object({
< paths = list(string)
< service = string
< }))
< }))
< })
< description = "Spec for building a URL Map. The first service in backends is also the default backend for whole the URL Map."
< }
<
Error: submodule's files generation has not been run, please run the
'make build' command and commit changes
- ⚠️check_documentation
The documentation needs to be regenerated. Please run
make generate_docs.
Checking for documentation generation
diff -r '--exclude=.terraform' '--exclude=.kitchen' '--exclude=.git' '--exclude=autogen' '--exclude=*.tfvars' /workspace/modules/serverless_negs/README.md /tmp/tmp.Ydkna0Vgkl/generate_docs/workspace/modules/serverless_negs/README.md
96c96
< | url\_map\_spec | Specification for building a URL Map to created backend services. | <pre>map(object({<br> hosts = list(string)<br> default_service = string<br> rules = list(object({<br> paths = list(string)<br> service = string<br> }))<br> }))</pre> | n/a | yes |
---
> | url\_map\_spec | Spec for building a URL Map. The first service in backends is also the default backend for whole the URL Map. | <pre>object({<br> default_service = string<br> host_rules = list(object({<br> hosts = list(string)<br> path_matcher = string<br> }))<br> path_matchers = map(object({<br> default_service = string<br> rules = list(object({<br> paths = list(string)<br> service = string<br> }))<br> }))<br> })</pre> | n/a | yes |
Error: Documentation generation has not been run, please run the
'make docker_generate_docs' command and commit the above changes.
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
This would be very useful @rsinnet!