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 support for regional NEG stripping of maxUtilization based on url #7066

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
3 changes: 3 additions & 0 deletions .changelog/3884.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: Added support to `google_compute_backend_service` for setting a serverless regional network endpoint group as `backend.group`
```
11 changes: 8 additions & 3 deletions google/resource_compute_backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"fmt"
"log"
"reflect"
"regexp"
"strconv"
"strings"
"time"

"github.com/hashicorp/errwrap"
Expand Down Expand Up @@ -3144,8 +3144,13 @@ func resourceComputeBackendServiceEncoder(d *schema.ResourceData, meta interface
if !ok {
continue
}
if strings.Contains(backendGroup.(string), "global/networkEndpointGroups") {
// Remove `max_utilization` from any backend that belongs to a global NEG. This field

match, err := regexp.MatchString("(?:global|regions/[^/]+)/networkEndpointGroups", backendGroup.(string))
if err != nil {
return nil, err
}
if match {
// Remove `max_utilization` from any backend that belongs to a serverless NEG. This field
// has a default value and causes API validation errors
backend["maxUtilization"] = nil
}
Expand Down