Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created gks.tf and vpc.tf #46

Merged
merged 1 commit into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions cloud/gcp/gks.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
variable "gke_num_nodes" {
type = number
default = "1"
description = "number of gke nodes"
}

#GKE CLUSTER
resource "google_container_cluster" "biot" {
name = "${var.gcp_project_id}-gke"
location = var.gcp_region

# We can't create a cluster with no node pool defined, but we want to only use
# separately managed node pools. So we create the smallest possible default
# node pool and immediately delete it.

remove_default_node_pool = true
initial_node_count = 1
}

# Separately Managed Node Pool
resource "google_container_node_pool" "node_pool" {
name = "${var.gcp_project_id}-node-pool"
location = var.gcp_region
cluster = var.gcp_project_id
node_count = var.gke_num_nodes

node_config {
preemptible = true
machine_type = "e2-medium"
}
}
18 changes: 18 additions & 0 deletions cloud/gcp/vpc.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "gcp_vpc_name" {
type = string
description = "vpc name"
}

# VPC
resource "google_compute_network" "vpc" {
name = "${var.gcp_vpc_name}-vpc"
auto_create_subnetworks = "false"
}

# Subnet
resource "google_compute_subnetwork" "subnet" {
name = "${var.gcp_vpc_name}-subnet"
region = var.gcp_region
network = google_compute_network.vpc.name
ip_cidr_range = "10.10.0.0/24"
}