File tree Expand file tree Collapse file tree 4 files changed +45
-4
lines changed
examples/basic_shared_vpc Expand file tree Collapse file tree 4 files changed +45
-4
lines changed Original file line number Diff line number Diff line change 1- # Simple Project
1+ # Simple shared VPC Project
22
3- This example enables shared VPC on a host project and attaches a service project.
3+ This example:
44
5- # Custom mode network
5+ * Enables shared VPC on a host project
6+ * Attaches a service project
7+ * Reserves an internal IP address in a subnet of a Shared VPC network
8+
9+ Note that the IP address configuration object is created in the service
10+ project, while its value comes from the range of available addresses in
11+ the chosen shared subnet.
612
7- This example configures a single simple custom mode VPC network inside of a project.
813
914<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
1015## Inputs
@@ -18,7 +23,10 @@ This example configures a single simple custom mode VPC network inside of a proj
1823
1924| Name | Description |
2025| ------| -------------|
26+ | ip\_ address | The internal IP address |
27+ | ip\_ address\_ name | The name of the internal IP |
2128| project | Host project ID |
2229| service\_ project | Service project ID |
30+ | subnet | Name of the host subnet |
2331
2432<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Original file line number Diff line number Diff line change @@ -36,3 +36,20 @@ resource "google_compute_shared_vpc_service_project" "service1" {
3636}
3737# [END vpc_shared_vpc_service_project_attach]
3838
39+ # [START compute_shared_internal_ip_create]
40+ data "google_compute_subnetwork" "subnet" {
41+ name = " my-subnet-123"
42+ project = var. project
43+ region = " us-central1"
44+ }
45+
46+ resource "google_compute_address" "internal" {
47+ project = var. service_project
48+ region = " us-central1"
49+ name = " int-ip"
50+ address_type = " INTERNAL"
51+ address = " 10.0.0.1"
52+ subnetwork = data. google_compute_subnetwork . subnet . self_link
53+ }
54+ # [END compute_shared_internal_ip_create]
55+
Original file line number Diff line number Diff line change @@ -23,3 +23,18 @@ output "service_project" {
2323 value = google_compute_shared_vpc_service_project. service1 . service_project
2424 description = " Service project ID"
2525}
26+
27+ output "ip_address_name" {
28+ value = google_compute_address. internal . name
29+ description = " The name of the internal IP"
30+ }
31+
32+ output "subnet" {
33+ value = google_compute_address. internal . subnetwork
34+ description = " Name of the host subnet"
35+ }
36+
37+ output "ip_address" {
38+ value = google_compute_address. internal . address
39+ description = " The internal IP address"
40+ }
Original file line number Diff line number Diff line change @@ -21,3 +21,4 @@ variable "project" {
2121variable "service_project" {
2222 description = " The service project ID"
2323}
24+
You can’t perform that action at this time.
0 commit comments