Skip to content

Commit

Permalink
Add purpose and role to subnetwork for L7 load balancing
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
Ty Larrabee authored and modular-magician committed Aug 14, 2019
1 parent 57bde0d commit 3d9ee2a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
12 changes: 1 addition & 11 deletions google/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,8 @@ func createIamBindingsMap(bindings []*cloudresourcemanager.Binding) map[string]m
}
// Get each member (user/principal) for the binding
for _, m := range b.Members {
// members are in <type>:<value> format
// <type> is case sensitive
// <value> isn't
// so let's lowercase the value and leave the type alone
pieces := strings.SplitN(m, ":", 2)
if len(pieces) > 1 {
pieces[1] = strings.ToLower(pieces[1])
}
m = strings.Join(pieces, ":")

// Add the member
bm[b.Role][m] = struct{}{}
bm[b.Role][strings.ToLower(m)] = struct{}{}
}
}
return bm
Expand Down
30 changes: 30 additions & 0 deletions website/docs/r/compute_subnetwork.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,36 @@ provider "google-beta"{
zone = "us-central1-a"
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgit.luolix.top%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=subnetwork_internal_l7lb&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Subnetwork Internal L7lb


```hcl
provider "google-beta" {
region = "us-central1"
zone = "us-central1-a"
}
resource "google_compute_subnetwork" "network-for-l7lb" {
provider = "google-beta"
name = "l7lb-test-subnetwork"
ip_cidr_range = "10.0.0.0/22"
region = "us-central1"
purpose = "INTERNAL_HTTPS_LOAD_BALANCER"
role = "ACTIVE"
network = "${google_compute_network.custom-test.self_link}"
}
resource "google_compute_network" "custom-test" {
provider = "google-beta"
name = "l7lb-test-network"
auto_create_subnetworks = false
}
```

## Argument Reference

Expand Down

0 comments on commit 3d9ee2a

Please sign in to comment.