terraform-google-modules/terraform-google-lb-http

Custom url_map resource inside the module

eitchugo opened this issue · 3 comments

TL;DR

I'm using terragrunt for implementing this module and I have a use case on creating a custom url_map resource with multiple host_rules and path_matchers. I'm getting a circular dependency error because to create the url map I need the backend service from this module, but to create the LB with a custom url_map I need the custom url_map already created.

So, implementing the custom url_map inside a module here would be great.

Terraform Resources

resource "google_compute_url_map" "default"

Detailed design

I did a quick and dirty proof of concept: eitchugo@0ad4b3d

It's working, but not complete.

I want your opinion if it's OK to create a Pull Request and work on this. What I have on my mind:

  • The url_map would be a sub-module that can be referenced on the main and other sub-modules. Any references to it would be replaced with module.url_map.output.self_link

  • The default url_map would stay the same, and a new variable would be created: create_url_map_resource. If this variable exists, it will replace the default url_map for this custom one (example in my code). This makes it a non-breaking change.

Additional information

Related issue: #245

+1, we're also experiencing this. Please fix!