Skip to content

Commit

Permalink
Update documentation of forwarding rule for vpc psc endpoint (#6864) (#…
Browse files Browse the repository at this point in the history
…13169)

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Dec 5, 2022
1 parent 05c962d commit a381116
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/6864.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
120 changes: 120 additions & 0 deletions website/docs/r/compute_forwarding_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,124 @@ resource "google_compute_subnetwork" "proxy" {
role = "ACTIVE"
}
```
<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%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=forwarding_rule_vpc_psc&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 - Forwarding Rule VPC Psc


```hcl
// Forwarding rule for VPC private service connect
resource "google_compute_forwarding_rule" "default" {
provider = google-beta
name = "psc-endpoint"
region = "us-central1"
load_balancing_scheme = ""
target = google_compute_service_attachment.producer_service_attachment.id
network = google_compute_network.consumer_net.name
ip_address = google_compute_address.consumer_address.id
}
// Consumer service endpoint
resource "google_compute_network" "consumer_net" {
provider = google-beta
name = "consumer-net"
auto_create_subnetworks = false
}
resource "google_compute_subnetwork" "consumer_subnet" {
provider = google-beta
name = "consumer-net"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
network = google_compute_network.consumer_net.id
}
resource "google_compute_address" "consumer_address" {
name = "website-ip-1"
provider = google-beta
region = "us-central1"
subnetwork = google_compute_subnetwork.consumer_subnet.id
address_type = "INTERNAL"
}
// Producer service attachment
resource "google_compute_network" "producer_net" {
provider = google-beta
name = "producer-net"
auto_create_subnetworks = false
}
resource "google_compute_subnetwork" "producer_subnet" {
provider = google-beta
name = "producer-net"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
network = google_compute_network.producer_net.id
}
resource "google_compute_subnetwork" "psc_producer_subnet" {
provider = google-beta
name = "producer-psc-net"
ip_cidr_range = "10.1.0.0/16"
region = "us-central1"
purpose = "PRIVATE_SERVICE_CONNECT"
network = google_compute_network.producer_net.id
}
resource "google_compute_service_attachment" "producer_service_attachment" {
provider = google-beta
name = "producer-service"
region = "us-central1"
description = "A service attachment configured with Terraform"
enable_proxy_protocol = true
connection_preference = "ACCEPT_AUTOMATIC"
nat_subnets = [google_compute_subnetwork.psc_producer_subnet.name]
target_service = google_compute_forwarding_rule.producer_target_service.id
}
resource "google_compute_forwarding_rule" "producer_target_service" {
provider = google-beta
name = "producer-forwarding-rule"
region = "us-central1"
load_balancing_scheme = "INTERNAL"
backend_service = google_compute_region_backend_service.producer_service_backend.id
all_ports = true
network = google_compute_network.producer_net.name
subnetwork = google_compute_subnetwork.producer_subnet.name
}
resource "google_compute_region_backend_service" "producer_service_backend" {
provider = google-beta
name = "producer-service-backend"
region = "us-central1"
health_checks = [google_compute_health_check.producer_service_health_check.id]
}
resource "google_compute_health_check" "producer_service_health_check" {
provider = google-beta
name = "producer-service-health-check"
check_interval_sec = 1
timeout_sec = 1
tcp_health_check {
port = "80"
}
}
```

## Argument Reference

Expand Down Expand Up @@ -1079,6 +1197,8 @@ The following arguments are supported:
and internal TCP/UDP load balancers.
EXTERNAL_MANAGED is used for regional external HTTP(S) load balancers.
INTERNAL_MANAGED is used for internal HTTP(S) load balancers.
([Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) only) Note: This field must be set to ""
if the target is an URI of a service attachment.
Default value is `EXTERNAL`.
Possible values are `EXTERNAL`, `EXTERNAL_MANAGED`, `INTERNAL`, and `INTERNAL_MANAGED`.

Expand Down

0 comments on commit a381116

Please sign in to comment.