Skip to content

Commit 1609af1

Browse files
chore: Added an example for creating a VM instance in a shared VPC (#284)
1 parent 56f5c7b commit 1609af1

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

examples/basic_shared_vpc/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ the chosen shared subnet.
2626
| ip\_address | The internal IP address |
2727
| ip\_address\_name | The name of the internal IP |
2828
| project | Host project ID |
29-
| service\_project | Service project ID |
3029
| subnet | Name of the host subnet |
3130

3231
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/basic_shared_vpc/main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,19 @@ resource "google_compute_address" "internal" {
5353
}
5454
# [END compute_shared_internal_ip_create]
5555

56+
# [START compute_shared_instance_create]
57+
resource "google_compute_instance" "default" {
58+
project = var.service_project
59+
zone = "us-central1-a"
60+
name = "my-vm"
61+
machine_type = "e2-medium"
62+
boot_disk {
63+
initialize_params {
64+
image = "debian-cloud/debian-9"
65+
}
66+
}
67+
network_interface {
68+
subnetwork = data.google_compute_subnetwork.subnet.self_link
69+
}
70+
}
71+
# [END compute_shared_instance_create]

examples/basic_shared_vpc/outputs.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ output "project" {
1919
description = "Host project ID"
2020
}
2121

22-
output "service_project" {
23-
value = google_compute_shared_vpc_service_project.service1.service_project
24-
description = "Service project ID"
25-
}
26-
2722
output "ip_address_name" {
2823
value = google_compute_address.internal.name
2924
description = "The name of the internal IP"

0 commit comments

Comments
 (0)