Switch to using an explicit net/subnet.
This commit is contained in:
@@ -3,11 +3,21 @@ variable "project" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "Region."
|
||||
type = string
|
||||
}
|
||||
|
||||
output "private_network_id" {
|
||||
description = "Private network id."
|
||||
value = google_compute_network.private_network.id
|
||||
}
|
||||
|
||||
output "private_subnetwork_id" {
|
||||
description = "Private subnetwork id."
|
||||
value = google_compute_subnetwork.subnet.id
|
||||
}
|
||||
|
||||
resource "google_project_service" "servicenetworking" {
|
||||
project = var.project
|
||||
service = "servicenetworking.googleapis.com"
|
||||
@@ -23,6 +33,13 @@ resource "google_compute_network" "private_network" {
|
||||
]
|
||||
}
|
||||
|
||||
resource "google_compute_subnetwork" "subnet" {
|
||||
name = "private-subnetwork"
|
||||
ip_cidr_range = "10.100.0.0/16"
|
||||
region = var.region
|
||||
network = google_compute_network.private_network.id
|
||||
}
|
||||
|
||||
resource "google_compute_global_address" "private_ip_address" {
|
||||
project = google_compute_network.private_network.project
|
||||
name = "private-ip-address"
|
||||
|
||||
Reference in New Issue
Block a user