Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 953228cf authored by Adam Robinson's avatar Adam Robinson
Browse files

networking submodule

parent 2fac286f
# Still need:
# write to DB - Figure out the curl piece (404 error)
resource "random_id" "id" {
byte_length = 2
}
locals{
project_name_string = substr(lower(replace(var.project_name, "/\\s/", "-")), 0, 25)
curl_body = {
......@@ -30,6 +22,10 @@ locals{
}
}
resource "random_id" "id" {
byte_length = 2
}
resource "google_project" "gcp_project" {
name = var.project_name
project_id = var.project_id == "" ? "${local.project_name_string}-${random_id.id.hex}" : var.project_id
......@@ -63,9 +59,16 @@ module "logging" {
log_export_destination_topic = var.log_export_destination_topic
}
module "networking" {
source = "./modules/networking"
project_id = google_project.gcp_project.project_id
vpc_prefix = var.vpc_prefix
gke_vpc_ranges = var.gke_vpc_ranges
}
module "vpn" {
source = "./modules/vpn"
count = var.vpn == true ? 1 : 0
count = var.vpn == true ? 1 : 0
project_id = google_project.gcp_project.project_id
regions = var.regions
......
locals {
default_cidr = "10.255.0.0/16"
default_subnets = {for x in var.regions : x => cidrsubnet(local.default_cidr,4,index(var.regions, x))}
pods_cidr = "10.255.128.0/17"
pods_range = {for x in var.regions : x => cidrsubnet(local.pods_cidr,3,index(var.regions, x))}
services_cidr = "10.255.224.0/19"
services_range = {for x in var.regions : x => cidrsubnet(local.services_cidr,3,index(var.regions, x))}
}
resource "google_compute_network" "default_vpc" {
project = var.project_id
name = "${var.vpc_prefix}-default"
routing_mode = "GLOBAL"
auto_create_subnetworks = false
}
resource "google_compute_subnetwork" "default_subnet" {
for_each = local.default_subnets
project = var.project_id
name = "default-${each.key}"
region = each.key
ip_cidr_range = each.value
network = google_compute_network.default_vpc.self_link
secondary_ip_range = var.gke_vpc_ranges ? [{range_name = "${each.key}-pods", ip_cidr_range = local.pods_range[each.key]},{range_name = "${each.key}-services", ip_cidr_range = local.services_range[each.key]}] : []
}
\ No newline at end of file
variable "project_id" {
type = string
}
variable "gke_vpc_ranges" {
type = bool
description = "If set to true, will create secondary IP address ranges in the first network in the region list"
default = false
}
variable "vpc_prefix" {
type = string
default = "um"
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment