Skip to content

Instantly share code, notes, and snippets.

@iamdejan
Last active May 26, 2022 06:51
Show Gist options
  • Save iamdejan/373e5f3d0ec82d38b658c93918aa8aa0 to your computer and use it in GitHub Desktop.
Save iamdejan/373e5f3d0ec82d38b658c93918aa8aa0 to your computer and use it in GitHub Desktop.
VPC and subnet for Google Cloud Provider
# VPC
resource "google_compute_network" "vpc" {
name = "${var.project_id}-vpc"
auto_create_subnetworks = "false"
}
# Subnet
resource "google_compute_subnetwork" "subnet" {
name = "${var.project_id}-subnet"
region = var.region
network = google_compute_network.vpc.name
ip_cidr_range = "10.10.0.0/24"
secondary_ip_range = [
{
ip_cidr_range = local.pods_cidr_range
range_name = "gke-${var.project_id}-gke-pods-72af974f"
},
{
ip_cidr_range = local.services_cidr_range
range_name = "gke-${var.project_id}-gke-services-72af974f"
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment