forked from faucetsdn/udmi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from Buildings-IOT/gcp_gke
Created gks.tf and vpc.tf
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |