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

google_compute_region_backend_service is missing port_name field #5551

Comments

@igorwwwwwwwwwwwwwwwwwwww
Copy link

igorwwwwwwwwwwwwwwwwwwww commented Jan 31, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

TLDR: The google_compute_region_backend_service resource is missing the port_name field, which appears to be defaulting to "http" at the moment.

This breaks configurations where protocol is "HTTPS" load_balancing_scheme is "INTERNAL_MANAGED", and a named port other than "http" is targeted.

For the time being we have set this manually via gcloud (with lifecycle.ignore_changes = all to prevent terraform from resetting it):

$ gcloud backend-services update default --port-name custom

I've taken a stab at a patch, but got stuck. The header in resource_compute_region_backend_service.go claims the file is auto-generated, but I was not able to find any source in magic modules. I'd be happy to open a PR from my branch and discuss further in the PR (let me know).

It's worth noting that there appear to be several other fields that are present in google_compute_backend_service but missing from google_compute_region_backend_service.

New or Affected Resource(s)

  • google_compute_region_backend_service

Potential Terraform Configuration

resource "google_compute_region_backend_service" "default" {
  name                  = "default"
  protocol              = "HTTPS"
  load_balancing_scheme = "INTERNAL_MANAGED"

  # this is the missing field that we need
  # port_name             = "custom"

  backend {
    balancing_mode = "UTILIZATION"
    group          = google_compute_instance_group.default.self_link
  }

  health_checks = [google_compute_health_check.http.self_link]
}

resource "google_compute_instance_group" "default" {
  ...

  named_port {
    name = "custom"
    port = "8080"
  }
}

References

cc @craigfurman

@ghost ghost added the enhancement label Jan 31, 2020
@danawillow danawillow added this to the Goals milestone Feb 3, 2020
@danawillow
Copy link
Contributor

For context, many fields were omitted from the region backend service resource because they couldn't actually be set on it, and we prefer to keep the resource only with fields that a user can actually set (even if they're present in the API). However, things change over time and it's possible that something that didn't used to work for a resource now does. For this specific one, the docs say:

Must be omitted when the loadBalancingScheme is INTERNAL

My recollection is that region backend services used to only support a loadBalancingScheme of INTERNAL, which would be why that field wouldn't work. Now that it can be INTERNAL_SELF_MANAGED, it's probably worth adding.

The reason you weren't able to find the source in magic modules is that it's fully generated (the ones in third_party are mostly handwritten, and so we just copy them directly from there to here). Take a look at the README at https://github.com/GoogleCloudPlatform/magic-modules and the codelab at https://codelabs.developers.google.com/codelabs/magic-modules/index.html for some information on how MM works. These changes will be smaller than the one in the codelab since it's just adding a field on an existing resource rather than adding a whole new resource.

If you're still interested in adding the missing fields, let me know and I'll assign this issue to you!

igorwwwwwwwwwwwwwwwwwwww added a commit to igorwwwwwwwwwwwwwwwwwwww/magic-modules that referenced this issue Feb 4, 2020
@Alfablos
Copy link

Hi guys,
we're pushing a little bit here: google backend_service to container_node_pool and named ports #1480

There you'll find a solution (a hack, actually) I've found.
Hope it helps

@quentinleclerc
Copy link

Hello,
@Alfablos it seems that it's not the same problem. Here the issue is that google_compute_region_backend_service is missing a field. It can not be solved with the workaround from container node_pool not containing named_ports!

Any news on this particular issue? I see that @igorwwwwwwwwwwwwwwwwwwww made a commit? @danawillow

Thanks!

@igorwwwwwwwwwwwwwwwwwwww
Copy link
Author

@quentinleclerc Unfortunately I was not able to submit the patch due to the CLA requirement on the magic-modules repo. Somebody else is going to have to do that.

@danawillow
Copy link
Contributor

Looks like there's already an open pr: GoogleCloudPlatform/magic-modules#3265

@ghost
Copy link

ghost commented Jun 8, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.