2024-06-16 10:41:35 +02:00
|
|
|
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_subnetwork
|
|
|
|
resource "google_project_service" "service_networking" {
|
|
|
|
service = "servicenetworking.googleapis.com"
|
2023-05-03 14:52:20 +02:00
|
|
|
project = var.project
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_network" "vpc" {
|
|
|
|
name = "${var.project}-vpc"
|
|
|
|
auto_create_subnetworks = "false"
|
2024-10-13 09:25:27 +02:00
|
|
|
depends_on = [google_project_service.service_networking]
|
2023-05-03 14:52:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_subnetwork" "subnet" {
|
|
|
|
name = "${var.project}-subnet"
|
|
|
|
region = var.region
|
|
|
|
network = google_compute_network.vpc.name
|
2024-06-16 10:41:35 +02:00
|
|
|
ip_cidr_range = "10.0.0.0/14"
|
2023-05-03 14:52:20 +02:00
|
|
|
private_ip_google_access = true
|
2024-06-16 10:41:35 +02:00
|
|
|
depends_on = [google_compute_network.vpc]
|
2023-05-03 14:52:20 +02:00
|
|
|
}
|